[英]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.