3
試圖使用ngFor指令在執行達特角2貝塔的時,會生成以下編譯時間錯誤0。達特執行角2指令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>
任何建議或幫助,將不勝感激。
當我嘗試在Angular 2 Beta中使用[ng2_form_examples](https://github.com/ng2-dample-samples/ng2_form_examples)時,我仍然收到相同的錯誤。 '屬性綁定ng-forOf沒有被嵌入模板上的任何指令使用(https://goo.gl/RWSnR7) –
其實它適用於我。我錯過了我的示例應用程序的模板中有另一個'ng-for'。在我將其改爲'ngFor'後,所有工作都正常。 –
謝謝。將檢查它 –