我已将Observable数组传递给模态对话框参数 . 打开模态对话框时,我从radlistview获得了一个具有[object Object]的值 .
但如果我使用listview它的工作正常 . 只有使用radlistview我才能解决这个问题 .
HomeComponent.ts:
public obsArr: ObservableArray<App>;
ngOnInit(){
this.obsArr= this.homeService.getMyApps();
}
const options = {
context: this.obsArr,
fullscreen: true,
viewContainerRef: this.vcRef
};
this.modal.showModal(FirstComponent, options).then((resource) => {
});
FirstComponent.ts: (Modal dialog)
public firstAppArr: ObservableArray<App>;
constructor(private params: ModalDialogParams, private routerExtensions: RouterExtensions) {
}
ngOnInit() {
this.firstAppArr= this.params.context;
}
first_component.html: (Modal dialog html)
<RadListView [items]="firstAppArr" itemReorder="true">
<ng-template let-item="item" let-i="index">
<GridLayout rows="auto" columns="*,*">
<StackLayout col="0" horizontalAlignment="left" verticalAlignment="center">
<Label [text]="item.name" textWrap="true"></Label>
</StackLayout>
<StackLayout col="1" horizontalAlignment="right" verticalAlignment="center">
<Label [text]="item.description" textWrap="true"></Label>
</StackLayout>
</GridLayout>
</ng-template>
</RadListView>
1 回答
现在您将
firstAppArr
设置为{"_observers":{}, "_array":[]}
的对象,这不是您要查找的数组 . 我建议做的是将ngOnInit()
更改为此访问对象的数组部分 .