Problem while updating angular 8 to angular 16. Error: Cant bind to "something" since it isn't a known property of "something"

huangapple go评论73阅读模式
英文:

Problem while updating angular 8 to angular 16. Error: Cant bind to "something" since it isn't a known property of "something"

问题

我正在将一个旧的 Angular 8 项目升级到 Angular 16。我已经更新了项目。但是现在编译项目时,出现了多个组件错误,例如“无法绑定到 'something',因为它不是 'something' 的已知属性”,其中 'something' 在这里就像某个属性一样,例如:无法绑定到 '',因为它不是 'div' 的已知属性。我相当确定我已经正确导入了所有内容,而且 app.module 中也一切正常。

注意:在从 Angular 8 升级到 Angular 15 时曾出现错误。这个错误是在从 Angular 15 升级到 16 时出现的。也许与完全移除的“ngcc”相关。

我已经检查了所有的导入和 app.module 文件。那里没有问题。我猜最有可能是与 Angular 16 中移除的 ngcc 有关。

英文:

I am updating an old angular 8 project to angular 16. I have updated the project. But now compiling the project is giving me multiple error on components "Cant bind to "something" since it isn't a known property of "something",where "something" here is like some property:for example: Cant bind to "<formsGroup>" since it isn't a known property of "div". I am pretty sure that i have done all imports rigth and also everthing is good in the app.module.

Note: There was error while I updated it from angular 8 to angular 15. This error occurs when I updated from angular 15 to 16. Maybe its related to "ngcc" which has been completly removed in angular 16.

I have done and checked all the imports and app.module file. There is nothing wrong there.I guess its most probably related to ngccbeen removed from angular 16.

答案1

得分: 1

我也在从15迁移到16后遇到了相同的问题。

英文:

I am also having same issue after migrating from 15 to 16

答案2

得分: 0

我通过在 NgModule 类中添加 schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA] 来修复了这个错误。

英文:

I fixed this error by adding

schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA] in the NgModule class

huangapple
  • 本文由 发表于 2023年7月11日 13:42:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/76658959.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定