我已将 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:( 模态对话框)
public firstAppArr: ObservableArray<App>;
constructor(private params: ModalDialogParams, private routerExtensions: RouterExtensions) {
}
ngOnInit() {
this.firstAppArr= this.params.context;
}
first_component.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>