Angular 2 中的小数管道 - 仅逗号,无小数位 [英] Decimal Pipe in Angular 2 - Commas Only, No Decimal Places

查看:16
本文介绍了Angular 2 中的小数管道 - 仅逗号,无小数位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用这个管道{{ product.productPrice |编号:'.2-2' }}

结果是 1,000,000.00 但我想删除 .00你是怎样做的?

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

推荐答案

使用这个:

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

1.0-0表示:小数点前至少一位,小数点后0位.

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

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

这篇关于Angular 2 中的小数管道 - 仅逗号,无小数位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆