chandings
chandings

Reputation: 549

Angularjs Currency filter, change currency dynamically?

I get the currency from the backend in a json object. When I try to show it using the currency filter what comes on screen is the currency code and not the actual currency.

I have used both the html binding method as well as the javascript method.

<span>{{smsData.smsAmount|currency:smsData.currencyCode}}<span>

The out put that i get is

&euro;1.00

when the expected out put is

€1.00

The same is true with using java script.

$scope.smsData.smsAmount = $filter('currency')($scope.smsData.smsAmount, $scope.smsData.currencyCode);

Please tell me how can i set the currency using parameters.

Upvotes: 3

Views: 2627

Answers (3)

runTarm
runTarm

Reputation: 11547

An another solution:

<span ng-bind-html="smsData.smsAmount | currency:smsData.currencyCode"></span>

Upvotes: 3

Alagarasan M
Alagarasan M

Reputation: 907

Try this:

<span>
   {{smsData.smsAmount| currency:"€"}}
</span>

Hope it helps..........!

Upvotes: 0

chandings
chandings

Reputation: 549

the solution i found is something like this:

<span ng-bind-html='smsData.currencyCode'></span><span>{{smsData.smsAmount|currency:''}}<span>

Please if anybody has a better solution then tell me.

Upvotes: 0

Related Questions