angularangularjstransloco

Angular TRANSLOCO library change currency symbol


I am going through the Angular Transloco library https://ngneat.github.io/transloco/, I have successfully installed and tried the examples https://ngneat.github.io/transloco/docs/plugins/locale/ all worked as expected. For example

<span>
   {{ 1000000 | translocoCurrency: 'symbol' : { minimumFractionDigits: 0 } }}
</span>

returns $1,000,000

Now I want to change or localise the currency from $ to let's say the Nigerian currency (NGN) but I can't find a way of doing this. I have gone through the documentation but that wasn't helpful.


Solution

  • In TranslocoCurrencyPipe, the next parameter after 'symbol' is the currency code.

    So you should do like this:

    <span>
       {{ 1000000 | translocoCurrency: 'symbol' : { minimumFractionDigits: 0 }: 'NGN' }}
    </span>