填写这份《一分钟调查》,帮我们(开发组)做得更好!去填写Home

DEFAULT_CURRENCY_CODE

如果没有传递任何货币代码,请提供此令牌来设置你的应用程序用于 CurrencyPipe 的默认货币代码。仅由 CurrencyPipe 使用,与语言环境的货币无关。如果未配置,则默认为 USD。

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.

查看"说明"...

      
      const DEFAULT_CURRENCY_CODE: InjectionToken<string>;
    

说明

有关更多信息,请参见《i18n 指南》

See the i18n guide for more information.

弃用通知:

Deprecation notice:

默认货币代码当前始终为 USD 但自 v9 起已弃用。

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

在 v10 中,默认货币代码将从当前语言环境中获取。

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

如果你需要以前的行为,请通过应用 NgModule 中的 DEFAULT_CURRENCY_CODE 提供者来进行设置:

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

Further information available in the 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' }]
});