简体   繁体   中英

How to remove currency symbol in AngularJS

Can anybody tell how to remove the currency symbol in AngularJS?

value = $filter('currency')(value);

I am getting a dollar symbol. I want to remove it.

I sadly don't yet have the required reputation to comment on an answer, but Samuel's answer needs a slight tweak. Just add the empty quotes, not value="".

<div> {{20 | currency:""}} </div>

Likewise you can use this same approach to override the dollar sign with any character, in this case pounds sterling:

<div> {{20 | currency:"&#163;"}} </div>

or even use the named representation rather than the decimal:

<div> {{20 | currency:"&pound"}} </div>

Just pass empty string as second argument to the filter function.

value = $filter('currency')(value, "");  

Also you can inject currencyFilter itself. You do not have to derive it from the filter Factory, with that you would just do:

value = currencyFilter(value, "");

Note the syntax :

$filter('currency')(amount, symbol, fractionSize)

您也可以在货币过滤器后通过空字符串进行查看。

<div> {{20 | currency:value=""}} </div>

You also can use space code;

{{20 | currency:" &nbsp "}}

&nbsp ; is space character. you can change &nbsp character

我正在使用Angular 6/7,你可以像这样清空货币符号

{{product?.price | currency:'&nbsp;'}}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM