我已将可观察数组传递给模态对话框参数。打开模式对话框时,我从radlistview has[object object]中得到一个值。
但如果我用ListView它的工作正常。只有用RadListView我才能解决这个问题。
家庭组件.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) => {
});
第一组件.ts:
(模式对话框)
public firstAppArr: ObservableArray<App>;
constructor(private params: ModalDialogParams, private routerExtensions: RouterExtensions) {
}
ngOnInit() {
this.firstAppArr= this.params.context;
}
第一个组件.html:
(模式对话框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>