使用popover/modalController创建的弹出窗口/模态不会提前创建,因此也不会创建内部内容。
参考:https://ionicframework.com/docs/api/popover#mounting-inner-contents
因此,您不能在modalController呈现的组件中使用类似的内容:
// page component
async presentPopoverFilter(e: Event) {
const popover = await this.modalController.create({
component: PopoverFiltersComponent,
componentProps: {
profile: this.profile,
filters: this.filters,
},
});
await popover.present();
}
// modal component
<ion-datetime-button datetime="datetime"></ion-datetime-button>
<ion-popover [keepContentsMounted]="true">
<ng-template>
<ion-datetime id="datetime"></ion-datetime>
</ng-template>
</ion-popover>
结果将是一个空弹出窗口。
1条答案
按热度按时间wnavrhmk1#
New version:
I solve this using a PopoverController inside my modal component:
Old version:
I solve this using a PopoverController inside my modal component with a small component to render the IonDateTime.