TranslateModule.forRoot 返回没有泛型类型参数的 ModuleWithProviders 类型

问题描述 投票:0回答:1

我已将我的角度应用程序从版本 5 迁移到版本 9。当我尝试构建时,它抛出以下错误。

"TranslateModule.forRoot returns a ModuleWithProviders type without a generic type argument. Please add a generic type argument to the ModuleWithProviders type."

我在 stackoverflow 中搜索了相同的内容,但发现了一些解决方案,但我有点困惑,因为我的 TranslateModule.forRoot 编写的是相同的 app.module.ts。我不确定应该传递什么参数以及如何传递参数以使其按照仅在 app.module.ts 文件中定义的方式工作。请是我的 app.module.ts 文件中的结构。

angular angular-routing angular9 angular-providers
1个回答
0
投票

当我将 Angular 从 15 升级到 16 时,我遇到了同样的问题,其中我的

@ngx-translate
版本是 11.0

升级后

@ngx-translate 16.x
我的问题得到解决。

命令: npm install --save @ngx-translate/core@15 --force

© www.soinside.com 2019 - 2024. All rights reserved.