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

情到浓时终转凉″ 提交于 2019-11-29 18:20:59

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/45955101/decimal-pipe-in-angular-2-commas-only-no-decimal-places

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!