私はこのチュートリアルに従うことをしようとしている:反復処理NativeScriptのGridLayout
http://www.blog.bdauria.com/?p=820
そして、このセクションに問題を持つ:
<GridLayout #boardGrid
[columns]="boardSideSpecification"
[rows]="boardSideSpecification">
<template ngFor let-item [ngForOf]="board.squares">
<StackLayout
[col]="item.yPosition"
[row]="item.xPosition"
[class]="classOf(item)">
</StackLayout>
</template>
問題は、ngForが最初のアイテムを吐き出しますが、それ以上アレイを繰り返すことはありません。
Image for: ngFor only provides first item
とラベルとそれを生成するために、実際のコード:だから私は、で終わる
<GridLayout #boardGrid
[columns]="boardSideSpecification"
[rows]="boardSideSpecification">
<template ngFor let-item [ngForOf]="board.squares">
<StackLayout
[col]="item.yPosition"
[row]="item.xPosition"
[class]="classOf(item)">
<Label text="{{item.xPosition}}, {{item.yPosition}}"></Label>
</StackLayout>
</template>
</GridLayout>
私が検索しようとし、この上の二日間壁に頭を叩いてきました合理的な修正。 GridLayoutをプログラムで作成したとしても、見てきましたが、すべてにはそれ自身の特別な問題があります。
誰かがこの仕事をする方法に関する情報を持っていれば、私はETERNALLYに感謝するでしょう。
ありがとうございます!
P.S.私は残りのコードの妥当性をチェックしたことに言及しておきたいと思います。私が期待しているアイテムを取得しています。イテレータ以外はすべて動作しています。