我正在尝试在运行时在管道中导入语言环境。在启动时,我收到此消息
错误:在webpackMissingModule(currency.pipe.ts:41)上找不到模块“ @ angular / common / locales”
我想做的是:
constructor(private translateService: TranslateService,
private basicsStore: BasicsStore) {
this.basicsStore.user$().subscribe(user => {
if (!user) return;
this.language = user.language;
this.country = user.country;
this.localeInitializer(this.language);
});
}
localeInitializer(localeId: string): Promise<any> {
return import(`@angular/common/locales/${localeId}.js`).then(locale => {
registerLocaleData(locale.default);
});
}
知道我在做什么错吗?谢谢。