我在新的 angular 项目设置中遇到以下错误。
Installed Packages and its versions
ERROR Error: Uncaught (in promise): Error: It looks like your application or one of its dependencies is using i18n. Angular 9 introduced a global
$localize()
function that needs to be loaded. Please addimport '@angular/localize';
to your polyfills.ts file. Error: It looks like your application or one of its dependencies is using i18n. Angular 9 introduced a global$localize()
function that needs to be loaded.
注意:我来自以下。它建议回退到旧版本。
https://github.com/angular/angular/issues/32508
最佳答案
你需要先确保你有 @angular/localize 包:npm install @angular/localize --save
然后,import '@angular/localize/init'
在您的 polyfills.ts 文件就像错误所说
关于Angular 9 引入了需要加载的全局 '$localize()' 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57953317/