When i use \'currency\' in angular js, I am getting a dollar symbol. How to get required currency symbols based on the requirements. As if now i need to know how to display
Currency pipe has 3 parameters
1. Desire currency code..
2. A Boolean value to indicate whether to display the currency symbol..
3. Digit info(has 3 parts): consist of minimum number of integer digit, minimum number of fractional digit and maximum number of fractional digit.
<span>{{value| currency:'1':2:'3'}}</span>
Example
<span>{{9.667| currency:'USD':true:'2.2-3'}}</span>
Output
$09.667
Refer for more details: https://angular.io/api/common/CurrencyPipe
For currency code: https://en.wikipedia.org/wiki/ISO_4217
If you want to show the currency in Indian rupee. use code INR
<span>{{100| currency:'INR':true}}</span>
Output
₹100.00
You can use the symbol parameter:
Item Price<span style="font-weight:bold;">{{item.price | currency[:symbol]}}</span>
Exemple:
Item Price<span style="font-weight:bold;">{{item.price | currency:"USD$"}}</span>
Please refer to this:
http://docs.angularjs.org/api/ng.filter:currency
The currency symbol can be changed from the default $ symbol to something else as follows:
In HTML Template Binding
{{ currency_expression | currency[:symbol] }}
In JavaScript
$filter('currency')(amount[, symbol])
We can display rupee symbol(in this case) for example as follows:
In HTML Template Binding
Item Price<span style="font-weight:bold;">{{price | currency:"₹"}}</span>
OR
In JavaScript
$scope.price=$filter('currency')($scope.price,"₹")
Also, we can add a text rather than a symbol if needed as follows:
Item Price<span style="font-weight:bold;">{{price | currency:"rupee"}}</span>
Note: Copying rupee symbol directly into HTML will not work.
See AngularJS currency documentation
To display currency symbol in angular js you need provide HTML entity for currency symbols below are the examples and usage in through code and in template :
Inside your Template example of Euro:
Item Price<span style="font-weight:bold;">{{price | currency:"€"}}</span>
example of Rupee:
Item Price<span style="font-weight:bold;">{{price | currency:"₹"}}</span>
Also check below url
http://www.cs.tut.fi/~jkorpela/html/euro.html
From controller :
Inject $filter in your controller
$scope.price=$filter('currency')($scope.price,'€')
See: http://docs.angularjs.org/api/ng.filter:currency
Simple with:
currency:"USD$"
and instead of USD$ use what ever you want