Set timeout to pop page to root after X seconds

Currently when a user submits a form it shows and thank you overlay - after 2.5 seconds I want the overlay to disappear.

My currently code looks like this.

ionViewWillEnter()
{
    setTimeout(() => {
        this.navCtrl.popToRoot();
    }, 2500);
}

But the page just stays on forever and never pops back to the root page

it is probably relevant how you show the “overlay”.

I use the ModalController and create that page and present it

Isn’t this the entire point of toasts?

2 Likes