How to move the symbol euro from the front of the value to after it?
Example:
{{product.price | currency : "€"}}
will produce € 12.00
but I would like 12.00 €
In Statistics Explained articles the symbol '€' should be used for euro in the text if it is followed by a number. This applies also to graphs and tables. It should be placed before the figure: €30.
If you want to display your own name instead of default currency symbol you have to pass display parameter. The display parameter can be “code” (currencycode will be displayed) or “symbol” or “symbol-narrow” or any other custom value.
AngularJS currency Filter The currency filter formats a number to a currency format. By default, the locale currency format is used.
Usage. When writing currency amounts, the location of the symbol varies by language. Many currencies in English-speaking countries and Latin America (except Haiti) place it before the amount (e.g., R$50,00).
You don't have to hack the currency filter!
AngularJS has a great support for i18n/l10n. The currency filter uses the default currency symbol from the locale service and positions it based on the locale settings.
So it's all about supporting and setting the right locale.
<script src="i18n/angular-locale_de-de.js"></script>
If you are using npm
or bower
all locales are available via the angular-i18n
package.
<span>{{ product.price | currency }}</span>
will now produce the following output:
65,95 €
Supporting multiple localizations
If you want to support multiple localizations be careful with the currency symbol as it changes to the default currency of the used locale. But 65,95 €
are different to $65,95
. Provide the currency symbol as parameter to be safe:
<span>{{ product.price | currency:'€' }}</span>
In de-de
the output would still be 65,95 €
but if the location is eg. en-us
it would be €65.95
(which is despite some other sayings the correct format to display euro prices in English).
To learn more about angular and i18n/l10n refer to the developer guide.
You can't with the currency filter. You could write your own, or just use the number filter.
{{(produce.price | number:2) + "€"}}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With