https://angular.io/api/common/DecimalPipe
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | @Component({ selector: 'number-pipe', template: `<div> <!--output '2.718'--> <p>e (no formatting): {{e | number}}</p> <!--output '002.71828'--> <p>e (3.1-5): {{e | number:'3.1-5'}}</p> <!--output '0,002.71828'--> <p>e (4.5-5): {{e | number:'4.5-5'}}</p> <!--output '0 002,71828'--> <p>e (french): {{e | number:'4.5-5':'fr'}}</p> <!--output '3.14'--> <p>pi (no formatting): {{pi | number}}</p> <!--output '003.14'--> <p>pi (3.1-5): {{pi | number:'3.1-5'}}</p> <!--output '003.14000'--> <p>pi (3.5-5): {{pi | number:'3.5-5'}}</p> </div>` }) export class NumberPipeComponent { pi: number = 3.14; e: number = 2.718281828459045; } | cs |
'개발 > angular' 카테고리의 다른 글
angular 기본 명령어 모음 (0) | 2019.05.16 |
---|---|
[Angular] 기본 명령어 (0) | 2018.04.23 |
[Pipe] 날짜 타입 변경 (0) | 2018.02.13 |
[Angular] 사이즈 조절 이벤트 (0) | 2018.02.13 |
[Pipe] List 나누기 (자르기), 문자열 나누기 (0) | 2018.02.13 |