DEFAULT_CURRENCY_CODE
상수
안정화
Provide this token to set the default currency code your application uses for CurrencyPipe when there is no currency code passed into it. This is only used by CurrencyPipe and has no relation to locale currency. Defaults to USD if not configured.
설명
Provide this token to set the default currency code your application uses for CurrencyPipe when there is no currency code passed into it. This is only used by CurrencyPipe and has no relation to locale currency. Defaults to USD if not configured.
See the i18n guide for more information.
The default currency code is currently always USD.
If you need the previous behavior then set it by creating a DEFAULT_CURRENCY_CODE provider in
your application NgModule:
{provide: DEFAULT_CURRENCY_CODE, useValue: 'USD'}
사용 시 참고사항
Example
In standalone apps:
import { LOCALE_ID, ApplicationConfig } from '@angular/core';
const appConfig: ApplicationConfig = {
providers: [{provide: DEFAULT_CURRENCY_CODE, useValue: 'EUR' }]
};
In module based apps:
import { platformBrowser } from '@angular/platform-browser';
import { AppModule } from './app/app.module';
platformBrowser().bootstrapModule(AppModule, {
providers: [{provide: DEFAULT_CURRENCY_CODE, useValue: 'EUR' }]
});
상세 내용으로 이동