Hello, I have a page that calls a modal which then calls another modal. The first modal is dismissed when the second modal appears. Now, depending on what a user does in the second modal, there might be data that needs to be returned to the page. Usually I would use the “onDidDismiss”-Function but with this I would return data from the second modal to the first modal (that is already dismissed when the data from the 2. modal arrives)
How would I get data from the second modal to the page? Here some code:
page.component:
async presentModal(event) {
const modal = await this.modalController.create({
component: NewOptionsModalComponent,
componentProps: {
data: event.coords
}
});
return await modal.present();
}
firstModal.component:
async close() {
await this.modalController.dismiss();
}
async presentSpotModal() {
this.close();
const modal = await this.modalController.create({
component: SecondModalComponent,
componentProps: {
data: this.data
}
});
return await modal.present();
}
SecondModal.Component:
async close(data) {
await this.modalController.dismiss(data);
}