Angular2货币符号 [英] Angular2 currency symbol

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

问题描述

我在澳大利亚试图显示一些货币价值,我正在这样做

I'm in Australia trying to show some currency values, I'm doing

{{ portfolio.currentValue | currency : 'AUD' : true : '4.0' }}

我得到的结果是 A $ 1,300,000 ,我想显示 $ 1,300,000 (无A)而不必更改为'USD'.

and I'm getting as result A$1,300,000, I would like to show $1,300,000 (no A) without having to change to 'USD'.

是否可以自定义我的货币符号?

Is there a way to customise my currency symbol?

推荐答案

您可以将您的语言环境设置为澳大利亚,然后以AUD货币为单位,只会显示$.

You can set your locale to Australia and then for AUD currency, it will just display a $.

在您的应用程序提供商中添加以下内容:

In your app providers add the following:

import { LOCALE_ID } from '@angular/core';
...
{ provide: LOCALE_ID, useValue: 'en-AU' }

然后下面将仅显示$:

{{ portfolio.currentValue | currency : 'AUD' : true : '4.0' }}

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

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