CurrencyPipe

export class CurrencyPipe

exported from angular2/common defined in angular2/src/common/pipes/number_pipe.ts (line 120)

WARNING: this pipe uses the Internationalization API. Therefore it is only reliable in Chrome and Opera browsers.

Formats a number as local currency.

Usage

  1. expression | currency[:currencyCode[:symbolDisplay[:digitInfo]]]

where currencyCode is the ISO 4217 currency code, such as "USD" for the US dollar and "EUR" for the euro. symbolDisplay is a boolean indicating whether to use the currency symbol (e.g. $) or the currency code (e.g. USD) in the output. The default for this value is false. For more information about digitInfo see DecimalPipe

Example

  1. @Component({
  2. selector: 'currency-example',
  3. template: `<div>
  4. <p>A: {{a | currency:'USD':false}}</p>
  5. <p>B: {{b | currency:'USD':true:'4.2-2'}}</p>
  6. </div>`
  7. })
  8. export class CurrencyPipeExample {
  9. a: number = 0.259;
  10. b: number = 1.3495;
  11. }

Annotations

@Pipe({name: 'currency'})

@Injectable()

Members

transform(value: any, args: any[]) : string

Not Yet Documented