I'm adding the following code in my app.module in order to set en-AU locale as default:
import { registerLocaleData } from '@angular/common';
import localeAu from '@angular/common/locales/en-AU';
registerLocaleData(localeAu);
@NgModule({
providers: [
{ provide: LOCALE_ID, useValue: 'en-AU' },
],
})
I've injected it into my component:
fee = 20.0
constructor(
@Inject(LOCALE_ID) public locale: string) {
}
When I try to view the locale in my component:
<h1>Current locale: </h1>
<h1>Fee default: </h1>
<h1>Fee AUD: </h1>
I see the following:
Current locale: en-AU
Fee default: USD20.00
Fee AUD: $20.00
Why is the default fee not $20.00?
from Angular en-AU locale not working for currency pipe
No comments:
Post a Comment