DecimalPipe

export class DecimalPipe

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

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

Formats a number as local text. i.e. group sizing and separator and other locale-specific configurations are based on the active locale.

Usage

expression | number[:digitInfo]

where expression is a number and digitInfo has the following format:

{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}

For more information on the acceptable range for each of these numbers and other details see your native internationalization library.

Example

@Component({ selector: 'number-example', template: `<div> <p>e (no formatting): {{e}}</p> <p>e (3.1-5): {{e | number:'3.1-5'}}</p> <p>pi (no formatting): {{pi}}</p> <p>pi (3.5-5): {{pi | number:'3.5-5'}}</p> </div>` }) export class NumberPipeExample { pi: number = 3.141; e: number = 2.718281828459045; }

Annotations

@Pipe({name: 'number'})

@Injectable()


Members

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

Not Yet Documented