在Angular 2 Beta 0的Dart实现中尝试使用ngFor指令时,会生成以下编译时错误。
Property binding ngForOf not used by any directive on an embedded template ("[ERROR ->]
<div *ngFor="#item of items">
{{item}}
</div>"):
零件:
library design;
import 'package:angular2/angular2.dart';
@Component(
selector: 'design-component',
templateUrl: 'design.html',
viewProviders: const [CORE_DIRECTIVES]
)
class DesignComponent {
List<String> items = ["One", "Two", "Three"];
}
模板:
<div *ngFor="#item of items">
{{item}}
</div>
任何建议或帮助,将不胜感激。
viewProviders
应该是directives
。viewProviders
用于依赖注入。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句