我需要以欧元显示价格,不带小数,并且每 3 位数字一个点。
因此价格 12350,30 将变为 12.350 €。
我试图用货币过滤器解决这个问题,但我只能让它与美元一起使用。然后我尝试了以下操作:
<span data-ng-bind="property.price | number:0"></span>
但我每 3 位数字得到一个逗号,而不是一个点。
而且我无法在末尾添加 € 符号。
有人知道怎么做吗?
最佳答案
And I am not able to add the € sign at the end.
您可以指定货币符号
{{ currency_expression | currency : symbol : fractionSize}}
所以
<span data-ng-bind="property.price | currency:"€":2></span>
But I get a comma every 3 digits instead of a dot.
小数点和组分隔符取决于语言环境,这里是 AngularJS 源代码中的相关部分
"NUMBER_FORMATS": {
"CURRENCY_SYM": "\u20ac",
"DECIMAL_SEP": ",",
"GROUP_SEP": "\u00a0",
源是 AngularJS 的法语 (fr-fr) 语言环境,https://github.com/angular/angular.js/blob/master/src/ngLocale/angular-locale_fr-fr.js#L78
关于javascript - 使用 Angular Filter 以欧元格式格式化价格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31032075/