Getting the currency symbol in lightning JS

I am using multiple currencies in my project and I have the currency ISO code. But the problem is, I want to get the symbol for currencies other than user locale. Is there any solution available for this?
Example :

in Lighting JS $A.get('$locale.currency') will return the user locale currency. I want to get the symbol for other currencies which are available in my org, Like Euro, Yen, etc.

Answer

lightning:formattedNumber allows you to pass a currency code dynamically and will render the appropriate symbol. All you need to do is in the init method set the currencyCode attribute to the current users iso code

example:

<lightning:formattedNumber value="10.00" style="currency" currencyCode="{!v.currencyCode}"/>

will render as
$10.00 if the users ISO code is USD

Heres a link to the documentation

Attribution
Source : Link , Question Author : Tarique Shamim , Answer Author : Calvin OKeefe

Leave a Comment