Is there a way to get a currency symbol from currency pipe? I have this piece of code in template:
{{ '' | currency : 'symbol' }}
But this shows nothing.
Note: I don't want to use getCurrencySymbol
method, because I want to use what currency pipe provides.
Update
Unlike How to hide currency symbol in angular currency pipe, I'was asking about how to show only the currency symbol. And found different solution than currency
pipe - I would like to share it.
If you just want the symbol, you could use the slice
pipe to get the first character e.g.
{{ 0 | currency | slice:0:1 }}
// $
There is also a utility function getCurrencySymbol
- which is probably used internally by the currency pipe
import { getCurrencySymbol } from '@angular/common';
getCurrencySymbol('GBP', 'narrow'); // £
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