export class 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
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
@Component({
selector: 'currency-example',
template: `<div>
<p>A: {{a | currency:'USD':false}}</p>
<p>B: {{b | currency:'USD':true:'4.2-2'}}</p>
</div>`
})
export class CurrencyPipeExample {
a: number = 0.259;
b: number = 1.3495;
}
Annotations
@Pipe({name: 'currency'})
@Pipe({name: 'currency'})
@Injectable()
@Injectable()
Members
transform(value: any, args: any[]) : string
transform(value: any, args: any[]) : string
Not Yet Documented