ObservableArray
与<ListView [items]="feedsComments"
一起使用,其中feedsComments
是NativeScript中的ObservableArray
。
但是当我用以下内容替换ListView
时:
<StackLayout *ngFor="let item of feedsComments">
</StackLayout>
它会抛出以下错误:
ERROR Error: Cannot find a differ supporting object '[object Object],[object Object]' of type 'object'.
NgFor only supports binding to Iterables such as Arrays.
答案 0 :(得分:0)
<StackLayout *ngFor="let item of feedsComments._array" height="100" width="100">
<Label [text]="item.someField"></Label>
</StackLayout>
丑陋,但它确实有效。似乎该类可以使用getItems()方法。但是有一个getItem(i)来获取数组中的特定项。