如何在角度2.0中设置数字的语言环境 [英] How to set locale for numbers in angular 2.0
本文介绍了如何在角度2.0中设置数字的语言环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
瑞士德语中的数字格式类似于"100'000.00"(而不是"100,000.00").我该如何改变呢?我试图将number_pipe.js中的设置从en-US更改为de-CH,但没有成功.
The number format in Swiss German is like "100'000.00" (not "100,000.00"). How can I change that? I tried to change the settings in number_pipe.js from en-US to de-CH without success.
var defaultLocale: string = 'de-CH';
是否有解决方法,或者我必须实现自己的管道?
Is there a workaround or do I have to implement my own pipe?
推荐答案
Try using the locale-number.pipe.ts or
您可以基于NumeralJs创建一个简单的管道以格式化数字
you could create a simple pipe based on NumeralJs to format numbers
https://github.com/adamwdraper/Numeral-js
这篇关于如何在角度2.0中设置数字的语言环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文