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

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

问题描述

我目前正在使用此管道 {{product.productPrice |数字:'。2-2'}}

I currently use this pipe {{ product.productPrice | number:'.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天全站免登陆