Help Angular by taking a 1 minute survey!Go to surveyHome

DeprecatedCurrencyPipe

Formats a number as currency using locale rules.

See more...

{{ value_expression | currency [ : currencyCode [ : symbolDisplay [ : digits ] ] ] }}
      
      {{ value_expression | currency [ : currencyCode [ : symbolDisplay [ : digits ] ] ] }}
    

NgModule

Input value

value any

Parameters

currencyCode string

Optional. Default is 'USD'.

symbolDisplay boolean

Optional. Default is false.

digits string

Optional. Default is undefined.

Description

Use currency to format a number as currency.

  • 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 or code.

    • true: use symbol (e.g. $).
    • false(default): use code (e.g. USD).
  • digitInfo See DecimalPipe for detailed description.

WARNING: this pipe uses the Internationalization API which is not yet available in all browsers and may require a polyfill. See Browser Support for details.

Usage notes

Example

@Component({ selector: 'deprecated-currency-pipe', template: `<div> <!--output 'CAD0.26'--> <p>A: {{a | currency:'CAD'}}</p> <!--output '$0,001.35'--> <p>B: {{b | currency:'CAD':true:'4.2-2'}}</p> </div>` }) export class DeprecatedCurrencyPipeComponent { a: number = 0.259; b: number = 1.3495; }
      
      @Component({
  selector: 'deprecated-currency-pipe',
  template: `<div>
    <!--output 'CAD0.26'-->
    <p>A: {{a | currency:'CAD'}}</p>

    <!--output '$0,001.35'-->
    <p>B: {{b | currency:'CAD':true:'4.2-2'}}</p>
  </div>`
})
export class DeprecatedCurrencyPipeComponent {
  a: number = 0.259;
  b: number = 1.3495;
}