angular-cn/public/docs/js/latest/api/pipes/DecimalPipe-class.jade

59 lines
1.5 KiB
Plaintext

p.location-badge.
exported from <a href='../pipes'>angular2/pipes</a>
defined in <a href="https://github.com/angular/angular/tree/2.0.0-alpha.33/modules/angular2/src/change_detection/pipes/number_pipe.ts#L52-L85">angular2/src/change_detection/pipes/number_pipe.ts (line 52)</a>
:markdown
Formats a number as local text. i.e. group sizing and seperator 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}
- minIntegerDigits is the minimum number of integer digits to use. Defaults to 1.
- minFractionDigits is the minimum number of digits after fraction. Defaults to 0.
- maxFractionDigits is the maximum number of digits after fraction. Defaults to 3.
For more information on the acceptable range for each of these numbers and other
details see your native internationalization library.
# Examples
{{ 123 | number }} // output is 123
{{ 123.1 | number: '.2-3' }} // output is 123.10
{{ 1 | number: '2.2' }} // output is 01.00
.l-main-section
h2 Annotations
.l-sub-section
h3.annotation CONST
pre.prettyprint
code.
@CONST()
.l-main-section
h2 Members
.l-sub-section
h3 transform
pre.prettyprint
code.
transform(value: any, args: any[])
:markdown