Reputation: 8484
Angualr JS code:
$scope.rupee = $filter('currency')($scope.dols * 67.33, 'INR', 3);
I am trying to insert html code inside this filter. That is instead of 'INR', I wish to get ₹ symbol. Please help me to solve this. And the problem is not getting the ₹ through filter. Instead of 'INR', I want to use ₹ but it's not rendering as I expected.
html code:
<div>{{rupee}}</div>
Upvotes: 1
Views: 178
Reputation: 2274
Modify your statement to
$scope.rupee = $filter('currency')($scope.dols * 67.33, '\u20B9', 3);
As you asked, "Can we write HTML code inside symbolFormat parameter?" Answer will be below:
It takes a string parameter, so whatever string you are providing, it will be used to apply as currency symbol
For reference you can check Here
Upvotes: 2
Reputation: 3820
You can try like this:
{{ currency_expression | currency : symbol : fractionSize}}
$scope.rupee = $filter('currency')($scope.dols * 67.33, '₹', 3);
See all use cases (currency symbol & sign - in controller & directly on view):
<div ng-app ng-controller="RupeeCtrl">
<b>From controller with sign</b><br/>
{{rupeeSign}}
<br/><br/>
<b>From controller with code</b><br/>
{{rupeeCode}}
<br/><br/>
<b>From view</b><br/>
{{ price | currency:'₹'}}
</div>
function RupeeCtrl($scope, $filter) {
$scope.price = 75.255;
$scope.rupeeSign = $filter('currency')($scope.price, '₹', 3);
$scope.rupeeCode = $filter('currency')($scope.price, '\u20B9', 3);
}
Mixed with answer from @Romesh Jain
Upvotes: 1
Reputation: 318
This looks like a duplicate question to this: How to get specific currency symbol(rupee symbol in my case) in angular js instead of the default one (dollar $ symbol)
Just use this ASCII code for the Rupee symbol: ₹
See the ASCII code here: http://www.fileformat.info/info/unicode/char/20b9/index.htm
Upvotes: 0