Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Decimal Pipe in Angular 2 - Commas Only, No Decimal Places

I currently use this pipe {{ product.productPrice | number:'.2-2' }}

And result is 1,000,000.00 but I want to remove the .00 How do you do that?

like image 231
Char Avatar asked Aug 30 '17 08:08

Char


1 Answers

Use this :

  {{product.productPrice | number: '1.0-0'}} 

1.0-0 means: at least one digit before decimal point, 0 digits after decimal point.

https://angular.io/api/common/DecimalPipe

like image 94
Vega Avatar answered Sep 17 '22 19:09

Vega