currency pipe
This is the documentation for Angular 6.
You can switch to the latest version Angular 10.
You can switch to the latest version Angular 10.
Transforms a number to a currency string, formatted according to locale rules that determine group sizing and separator, decimal-point character, and other locale-specific configurations.
Source
<p>A: {{a | currency}}</p>
<p>A: {{a | currency:'CAD'}}</p>
<p>A: {{a | currency:'CAD':'code'}}</p>
<p>B: {{b | currency:'CAD':'symbol':'4.2-2'}}</p>
<p>B: {{b | currency:'CAD':'symbol-narrow':'4.2-2'}}</p>
<p>B: {{b | currency:'CLP'}}</p>
export class AppComponent {
a = 0.259;
b = 1.3495;
}
Result
A: $0.26
A: CA$0.26
A: CAD0.26
B: CA$0,001.35
B: $0,001.35
B: CLP1
Parameters
{{ value_expression | currency [ : currencyCode [ : display [ : digitsInfo [ : locale ] ] ] ] }}
currencyCode
#
currencyCode?: string
display
#
display: 'code'|'symbol'|'symbol-narrow'|string|boolean = 'symbol'
digitsInfo
#
digitsInfo?: string
locale
#
locale?: string