Reputation: 4967
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.
Upvotes: 4
Views: 12337
Reputation: 4284
I am using Angular 6/7 by this you can empty the currency symbol like this
{{product?.price | currency:' '}}
Upvotes: 1
Reputation: 387
You also can use space code;
{{20 | currency:" "}}
  ; is space character. you can change   character
Upvotes: 1
Reputation: 1067
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:"£"}} </div>
or even use the named representation rather than the decimal:
<div> {{20 | currency:"£"}} </div>
Upvotes: 16
Reputation: 1443
You also can do it in view with just pass empty string after currency filter.
<div> {{20 | currency:value=""}} </div>
Upvotes: 5
Reputation: 123739
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, "");
$filter('currency')(amount, symbol, fractionSize)
Upvotes: 6