简体   繁体   English

Angular 2 RC5:无法绑定到'ngFor',因为它不是已知的属性

[英]Angular 2 RC5: Can't bind to 'ngFor' since it isn't a known property of

After upgrading to RC5, I suddenly got this error: 升级到RC5后,我突然遇到这个错误:

Can't bind to 'ngFor' since it isn't a known property of 'div'. ("

<div [ERROR ->]*ngFor="t of test">{{t}}</div>")

The HTML: HTML:

<div *ngFor="t of test">asdas</div>

All posts on this topic explain that you need to import BrowserModule, but I already did that. 本主题的所有帖子都说明您需要导入BrowserModule,但我已经这样做了。

After banging my head against the wall, I found the solution: I had forgotten the word "let" in front of my variable! 在我的头碰到墙后,我找到了解决方案:我忘记了变量前面的“let”这个词!

Pre RC5 this used to work, so this is a breaking change in RC5. 预备RC5用于工作,所以这是RC5的一个突破性变化。 I know let is required, but previously this just worked. 我知道让我们需要,但之前这只是有效的。 And the error is not helpful at all. 而错误根本没有用。

Hope this helps! 希望这可以帮助!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Angular2 RC5:无法绑定到“属性 X”,因为它不是“子组件”的已知属性 - Angular2 RC5: Can't bind to 'Property X' since it isn't a known property of 'Child Component' RC5中的外部模块:由于它不是已知属性,因此无法绑定到“ X” - External Module in RC5: Can't bind to 'X' since it isn't a known property Angular 2 RC 5 - 无法绑定到&#39;...&#39;,因为它不是&#39;...&#39;的已知属性 - Angular 2 RC 5 - Can't bind to '…' since it isn't a known property of '…' Angular:ngFor中的三元运算符抛出错误无法绑定到“ ngFor”,因为它不是“ div”的已知属性 - Angular: ternary operator in ngFor throw error Can't bind to 'ngFor' since it isn't a known property of 'div' 无法绑定到“ ngFor”,因为它不是已知的本机属性 - Can't bind to 'ngFor' since it isn't a known native property “无法绑定到&#39;ngFor&#39;,因为它不是已知的本机属性” - “Can't bind to 'ngFor' since it isn't a known native property” 无法绑定到“*ngFor”,因为它不是“div”的已知属性 - Can't bind to '*ngFor' since it isn't a known property of 'div' Angular 2 * ngFor错误:无法绑定到“ menuitemtype”,因为它不是“ div”的已知属性 - Angular 2 *ngFor error: Can't bind to 'menuitemtype' since it isn't a known property of 'div' 无法绑定到“ngForOf”,因为它不是 ngFor Angular 中“li”的已知属性 - Can't bind to 'ngForOf' since it isn't a known property of 'li' in ngFor Angular 无法绑定到“ngFor”,因为它不是...在混合 AngularJS 和 Angular 应用程序上的已知属性 - Can't bind to 'ngFor' since it isn't a known property of ... on hybrid AngularJS & Angular application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM