Can you possibly do something like this in angular?
It\'s not quite possib
Some locales have the currency sign prefixed, some postfixed, e.g. "one hundred euros" would be rendered "€ 100" or "100 €". What then?
If you don't mind doing some parsing, however read on:
The $locale
service contains the symbols required for currency formatting:
$locale.NUMBER_FORMATS.CURRENCY_SYM
$locale.NUMBER_FORMATS.DECIMAL_SEP
(And there is more detailed info in $locale.NUMBER_FORMATS.PATTERNS[]
- the value at position [1]
is for currencies)
You could create a directive that uses the currency
filter to obtain the initial formatted string, e.g. "1 000 000,50 €"
then search for $locale.NUMBER_FORMATS.CURRENCY_SYM
and replace it with {{ $locale.NUMBER_FORMATS.CURRENCY_SYM }}
, do something similar for the decimal separator and then set the innerHTML
of an element.