如何在Nativescript中使用ObservableArray使*ngFor工作?

如何在Nativescript中使用ObservableArray使*ngFor工作?,nativescript,ngfor,nativescript-angular,Nativescript,Ngfor,Nativescript Angular,observearray与 很难看,但很管用。似乎该类可以使用getItems()方法。虽然有一个getItem(i)用于获取数组中的特定项。看起来代码丢失了。适用于不适用于如果要通过常规*ngFor,需要首先将nativescript ObservableArray转换为常规数组。否则,您需要在为您处理列表的自定义组件中使用ng模板(这也是ListView组件正在做的)。 <StackLayout *ngFor="let item of feedsComments"> </

observearray


很难看,但很管用。似乎该类可以使用getItems()方法。虽然有一个getItem(i)用于获取数组中的特定项。

看起来代码丢失了。适用于不适用于如果要通过常规*ngFor,需要首先将nativescript ObservableArray转换为常规数组。否则,您需要在为您处理列表的自定义组件中使用ng模板(这也是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. 
<StackLayout *ngFor="let item of feedsComments._array" height="100" width="100">
    <Label [text]="item.someField"></Label> 
</StackLayout>