user386430
user386430

Reputation: 4967

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.

Upvotes: 4

Views: 12337

Answers (5)

Akitha_MJ
Akitha_MJ

Reputation: 4284

I am using Angular 6/7 by this you can empty the currency symbol like this

{{product?.price | currency:' '}}

Upvotes: 1

Burak Odabaş
Burak Odabaş

Reputation: 387

You also can use space code;

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

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

Upvotes: 1

Eric Soyke
Eric Soyke

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:"&#163;"}} </div>

or even use the named representation rather than the decimal:

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

Upvotes: 16

SKL
SKL

Reputation: 1443

You also can do it in view with just pass empty string after currency filter.

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

Upvotes: 5

PSL
PSL

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, "");

Note the syntax:

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

Upvotes: 6

Related Questions