货币管道在Angular 2 [英] Currency Pipe in Angular 2

查看:122
本文介绍了货币管道在Angular 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我想以USD格式显示价格,即逗号 例如$ 123,456 但是如果在角度2中使用货币管道与USD,我必须具有$或USD 我可以只显示不带美元和美元的数字吗?

Hi I want to display price in USD format i.e, for commas for eg. $123,456 But if use currency pipe in angular 2 with USD ,i have to have either $ or USD Is it possible that I can display only number without USD and $?

我的代码是{{123456 | currency:'USD':true:'1.2-2'}}

My code is {{123456 | currency:'USD':true:'1.2-2'}}

将其设置为false会给我错误.

making it to false giving me error.

我将显示为$ 123,456或USD123,456. 但我希望它是123,456.

I am getting display as $123,456 or USD123,456. BUT i want it as 123,456.

推荐答案

也许您可以只使用

Maybe you could just use the DecimalPipe. It seems to cover your needs.

{{123456 | number:'.2-2'}} would become 123,456.00

这篇关于货币管道在Angular 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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