• Overview
@angular/core

DEFAULT_CURRENCY_CODE

constant

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.

Description

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.

Deprecation notice:

The default currency code is currently always USD but this is deprecated from v9.

In v10 the default currency code will be taken from the current locale.

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'}

Usage Notes

Example

          
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';import { AppModule } from './app/app.module';platformBrowserDynamic().bootstrapModule(AppModule, {  providers: [{provide: DEFAULT_CURRENCY_CODE, useValue: 'EUR' }]});
Jump to details