W3cubDocs

/Angular 10

DEFAULT_CURRENCY_CODE

const

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 more...

const DEFAULT_CURRENCY_CODE: InjectionToken<string>;

Description

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' }]
});

© 2010–2020 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v10.angular.io/api/core/DEFAULT_CURRENCY_CODE