Ionic 3 How to display a toast on modal?

Hello I have uncommon structure of creating activity. First user on page OverviewPage can open the modal, which after selecting one activity from list pushes to desired ActivityPage - activity creation page.

Once user leaves ActivityPage, submit new activity I use nav methods in that order

this.navCtrl.getPrevious().data.toastMessage = 'Added activity successfully';
this.navCtrl.pop();

After adding new activity it returns to OverviewPage with modal opened, unfortunately it doesn’t reload that page so I cannot detect in ionViewWillEnter if I can show that popover.

if(this.navParams.data.toastMessage) {
 this.presentToast(this.navParams.data.toastMessage)
}

How can I change code to display that toastMessage in modal after creating new activity ? Thank you.

Respectfully, I think this is the fundamental problem here, both technically and practically. Users extrapolate from their previous experiences to form expectations of how apps and their UI components are going to behave, and when there’s a mismatch there, it’s disorienting and frustrating. Likewise, framework authors design frameworks to encourage following well-traveled paths.

There are a number of ways to go here, but the key I think is the contract of a modal. A modal means “your normal flow of work needs to be interrupted in order to take care of this single, short, urgent task”, and anything that involves navigating away from the page that popped the modal is neither single, short, nor urgent. So I would try to redesign this workflow in order to eliminate the modal, at which point your technical problem should also vanish.

1 Like

Thank you for your answer. I will change it to be ionic/user friendly way in a future. For know I left it without sending Toast to parent components. Surprisingly it works okay.