Angular Currency Filter - Symbol  added

拥有回忆 提交于 2019-12-22 01:33:13

问题


I'm using angular's currency filter and it seems to be outputting an extra symbol: Â.

The html:

{{totals.subtotal | currency}}
{{totals.tax | currency}}
{{totals.total | currency}}

The object totals:

var totals = {subtotal: 500, tax: 65, total: 565};

Output:

Â$500.00
Â$65.00
Â$565.00

Has anyone encountered this before? I'm using the latest angular 1.0.6

Update: It turns out the minification of angular caused this. When I included the non minified angular it fixed it.


回答1:


Yeah confirmed that this is uglify.

If you build it with the ascii_only=true option then it seems to resolve the problem.




回答2:


Make sure you have this meta tag.

<meta charset="utf-8">



回答3:


It seems that when you minify Angular yourself with Uglify.js, and possibly when you combine it with other scripts into one concatenated file and then minify, this issue arises. To solve it you should include the pre-minified version of Angular in your project instead of the development version. I'm not sure if the problem is due to Uglify.js or Angular, but this is how I fixed it.




回答4:


Updating Uglify seems to resolve the issue together with

uglify({ 'ascii-only': true })


来源:https://stackoverflow.com/questions/16018142/angular-currency-filter-symbol-%c3%82-added

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!