In Ionic 4, I would like to pass data from Popover controller to the view page.
I am able to get the data onDismiss()
but I would like to do it without exiting the popover.
Below is the code snippet I tried onDismiss()
and it worked.
Do we any other popover methods or state changes that can be captured
Page
async presentPopover(opts) {
console.log(opts);
const popover = await this.popoverController.create({
component: RouteDetailsPopoverComponent,
componentProps: {
viewType: this.viewType
},
event: opts.event
});
popover.onDidDismiss()
.then((result) => {
console.log(result['data']);
this.viewType = result['data'];
});
return await popover.present();
}
And here's the popover component
changeRouteDetailView(mode: View) {
this.viewType = mode;
this.popCtrl.dismiss(this.viewType);
}
Without dismissing the popover, can I pass the data back?