英文:
Angular TRANSLOCO library change currency symbol
问题
我正在使用Angular的Transloco库https://ngneat.github.io/transloco/,我已经成功安装并尝试了示例https://ngneat.github.io/transloco/docs/plugins/locale/,所有示例都按预期工作。例如
<span>
{{ 1000000 | translocoCurrency: 'symbol' : { minimumFractionDigits: 0 } }}
</span>
返回$1,000,000
现在我想将货币从$
更改或本地化为尼日利亚货币(NGN)
,但我找不到方法。我已经查阅了文档,但没有找到有用的信息。
英文:
I am going through the Angular Transloco library https://ngneat.github.io/transloco/, I have successfully installed and tried the examples https://ngneat.github.io/transloco/docs/plugins/locale/ all worked as expected. For example
<span>
{{ 1000000 | translocoCurrency: 'symbol' : { minimumFractionDigits: 0 } }}
</span>
returns $1,000,000
Now I want to change or localise the currency from $
to let's say the Nigerian currency (NGN)
but I can't find a way of doing this. I have gone through the documentation but that wasn't helpful.
答案1
得分: 1
In TranslocoCurrencyPipe,'symbol'之后的下一个参数是货币代码。
因此,您应该这样做:
<span>
{{ 1000000 | translocoCurrency: 'symbol' : { minimumFractionDigits: 0 }: 'NGN' }}
</span>
英文:
In TranslocoCurrencyPipe, the next parameter after 'symbol' is the currency code.
So you should do like this:
<span>
{{ 1000000 | translocoCurrency: 'symbol' : { minimumFractionDigits: 0 }: 'NGN' }}
</span>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论