Currency Pipe in Angular

Currency Pipe in Angular

Currency Pipe will transform a number to a currency value of type string, and format it based on ones locale rules which will decide group sizing and separator, decimal-point character, and other locale specific configurations.

This is one of the built in pipe in Angular used to format currency value according to given country code,currency,decimal,locale information.

Syntax of Currency pipe Angular :

{{ value_expression | currency [ : currencyCode [ : display [ : digitsInfo [ : locale ] ] ] ] }}

Example:

app.component.ts

price: number = 10050.4521;

app.component.html

{{ price | currency }} //output $10,050.45


Read the Complete Article in Depth here for various Use Cases: Use of Currency Pipe in Angular


πŸ”₯ 7 Views
Aug 29, 2022