Last Updated : 03 Jun, 2021
In this article, we are going to see what is CurrencyPipe in Angular 10 and how to use it. CurrencyPipe is used to transform a number to a currency string, formatted according to locale rules that determine group sizing and separator, decimal-point character
Syntax:
{{ value | currency }}
Approach:
Parameters:
Example 1:
app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html'
})
export class AppComponent {
// Currency variable to be used
a = 100;
}
app.component.html
<!-- Default currency is in Dollars-->
<p>A: {{a | currency}}</p>
<!-- INR CurrrenyCode is used for Rupees symbol-->
<p>A: {{a | currency:'INR'}}</p>
<!-- INR CurrrenyCode is used-->
<p>A: {{a | currency:'INR':'code'}}</p>
<!-- EUR CurrrenyCode is used for Europeon Currency-->
<p>A: {{a | currency:'EUR'}}</p>
Output:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4