Reputation: 21
i am having this problem:
{{100 | currency:'€'}}
the output is fine 100 €, but when i change the language for example en-US culture, the symbol changes its position so it becomes € 100.
What i want is that symbol stays on its position even language is changed. i can do like:
{{100 | currency:''}} {{'€'}}
but in that case if i have $ as currency, it will be 100$ not $100.
So i don't want hard coded stuff, i would like to have dynamic filter that will set place of its symbol in one place.
Thanks in advance.
Upvotes: 2
Views: 412
Reputation: 1938
You can implement your own filter or directive, but I think the better approach would be to set the locale on Angular using l10n.
And if you need to force a change of localization from europe to en-Us you can do it programmatically, this make sense because you need to convert EUR to USD$.
Upvotes: 1
Reputation: 1182
You can implement your custom filter like
app.filter('customCurrency', function () {
return function (value) {
// Do your logic here and append your currency
// symbol before or after of your value as per your requirement
return value
}; });
Upvotes: 1