Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70769

Ionic 4 nesting modals - how to trigger parent close by child close

$
0
0

@hugovisk wrote:

Hi folks!

I’m have one modal (parent) that calls another modal on top of it (child), the behavior of the child in this scenario is:
user select an option and it returns to the parent, if the user close the child modal without choosing an option it should close the parent modal and redirect to other page.

Someone knows if is there a right way of doing that?

the way I’m trying on parent modal:

async displayChild() {
const modal = await this.modalController.create({
component: ChildModalComponent
});

await modal.present();

const {data} = await modal.onWillDismiss();

if (!data) {
await this.modalControler.dismiss();
}
}

With this .dismiss(); call nothing happens, but if I wrap it in a setTimeOut it closes the parent modal.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70769

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>