zer0
zer0

Reputation: 5017

Angular Locale settings not working

I want to customize my Angular app locale to 'en-GB' and did as the answer here suggests: Angular 5 Breaking change - manually import locale

import { registerLocaleData } from '@angular/common';
import localeGB from '@angular/common/locales/en-GB';

registerLocaleData(localeGB, 'en-GB');

...

providers: [{ provide: LOCALE_ID, useValue: 'en-GB' }]

But this didn't fix my issue and the currency pipe outputs $ instead of £.

Upvotes: 1

Views: 1563

Answers (1)

Anshuman Jaiswal
Anshuman Jaiswal

Reputation: 5462

You will have to pass currencyCode to display £ because default is undefined and it display $. Use it as:

<span>{{amount | currency:'GBP'}}</span>

there is no relation between locale & currency code, locale generally used for format of different things (like number) i.e. how it would be displayed in particular locale. E.g. at some places , is being used at the place of . (decimal); or what should be the thousand separator.

Upvotes: 2

Related Questions