を動作していないが、私のコンポーネントです:角度2 * ngFor後
import { Component } from 'angular2/core';
@Component({
selector: 'test',
template:
`
<ul >
<li *ngFor="let t of test">
<span >{{t}}</span>
</li>
</ul>
`
})
export class TestComponent implements OnInit{
test: string[];
constructor(){
this.test = ["Saab", "Volvo", "BMW"];
}
}
私はコンポーネントをロードしようとすると、私は次のエラーを取得しています:
EXCEPTION: Template parse errors:
Can't bind to 'ngFor' since it isn't a known native property ("<ul >
<li [ERROR ->]*ngFor="let t of test">
<span >{{t}}</span>
</li>
"):
はまた、私は私かどうかわかりませんコンポーネントをインポートするときに '@ angle/core'または 'angular2/core'を使用する必要があります。
'を角度/ core'はリリース候補版から来ている@ angular.io
ご希望により、角2
see commonModule documentationからの指令に建て追加し、最近です。あなたはなぜこのエラーを見ているのかはっきりしていません。 – Katana314
Angular2のどのバージョンを使用していますか? –
"2.0.0-rc.1"を使用している場合は、 '@ angular/core'からインポートすることを検討してください。 – pingo