1
hereとhereを検索しました。私は、角2用のバージョン2.0.0-beta.7を使用していますが、それはこのように私にエラーを与えている:例外:テンプレート解析エラー:「ngForFrom」にバインドできません。既知のネイティブプロパティではないため、
EXCEPTION: Template parse errors:
Can't bind to 'ngForFrom' since it isn't a known native property ("<h2>list of fruits</h2>
<ul>
<li [ERROR ->]*ngFor="#item from itemList">{{item.name}}</li>
</ul>"): [email protected]:4
Property binding ngForFrom not used by any directive on an embedded template ("<h2>list of fruits</h2>
<ul>
としてあたりが、それはキャメルケースを使用している知っているが、それは私のために働いていません。ここで
は私.TSファイルです:
import {Component} from "angular2/core";
@Component({
selector:'my-list'
template:`<h2>list of fruits</h2>
<ul>
<li *ngFor="#item from itemList">{{item.name}}</li>
</ul>`
})
export class ItemComponent{
public itemList=[
{name:"Apple"},
{name:"Orange"},
{name:"Grapes"}
];
}
'#item itemList'を' #item of itemList'に変更します。 – yurzui
'* ngFor =" itemList "item"を使ってみてください。 –
@ Lenilson de Castro彼は古いバージョンを使用していると思われますので、 'let'は動作しません。 – yurzui