1//{{ value_expression | number [ : digitsInfo [ : locale ] ] }}
2
3//Assume someNumber = 12.221
4 <!--output '12'-->
5 <p>{{ someNumber | number : '1.0-0'}}</p>
6
7//The output here is '12' because we cut the decimals off
8//with the number pipe
9
10//More examples from Angular:
11
12 //Assume:
13 //pi: number = 3.14;
14 //e: number = 2.718281828459045;
15
16 <!--output '2.718'-->
17 <p>e (no formatting): {{e | number}}</p>
18
19 <!--output '002.71828'-->
20 <p>e (3.1-5): {{e | number:'3.1-5'}}</p>
21
22 <!--output '0,002.71828'-->
23 <p>e (4.5-5): {{e | number:'4.5-5'}}</p>
24
25 <!--output '0 002,71828'-->
26 <p>e (french): {{e | number:'4.5-5':'fr'}}</p>
27
28 <!--output '3.14'-->
29 <p>pi (no formatting): {{pi | number}}</p>
30
31 <!--output '003.14'-->
32 <p>pi (3.1-5): {{pi | number:'3.1-5'}}</p>
33
34 <!--output '003.14000'-->
35 <p>pi (3.5-5): {{pi | number:'3.5-5'}}</p>
36
37 <!--output '-3' / unlike '-2' by Math.round()-->
38 <p>-2.5 (1.0-0): {{-2.5 | number:'1.0-0'}}</p>
39
40//More information here: https://angular.io/api/common/DecimalPipe