【发布时间】:2018-02-09 13:43:12
【问题描述】:
我正在使用带有 JIT 编译器的 Angular 4.3.3,并在运行我的应用程序时收到以下错误:
Property binding ngforOf not used by any directive on an embedded template.
Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations".
我已确保在我的主应用程序模块中导入BrowserModule,并在我的子模块中导入了CommonModule,该错误源自于此。
这是引发错误的模板:
<div class="background"></div>
<div class="content normal-page">
<ons-fab position="top right" ripple>+</ons-fab>
<ons-list>
<ons-list-item *ngFor="let item of items; let i = index">
<div class="center">
#{{i}} msg: {{item.msg}}
</div>
</ons-list-item>
</ons-list>
</div>
由于我将正确的模块导入到正确的位置,可能导致此错误的原因是什么?
【问题讨论】:
标签: angular angular2-directives