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.
1 回答
丑陋,但它的工作原理 . 似乎该类可以使用getItems()方法 . 但是有一个getItem(i)来获取数组中的特定项 .