Is there a way to send a person to a page etc if alert button(s) are not pressed after a certain timeout.
I know how to send people to a page if they do press the buttons but want to send people people to a page if they do not press alert button after a certain time.
Maybe you can use a setTimeout() with a function that navigates to the page right after/before you show the alert, and only cancel it if the button is pressed. Like:
Thanks @FdezRomero that works but the alert still appears when it goes to the next page. Is there anyway when it goes to the specific page it dismiss the alert.
I tried the below code but the alert disappears instantly but I would like it to only disappear if it goes to the specific page
alert.present();
var timeout = setTimeout(() => this.navCtrl.push('SpecificPage'), 6000);
alert.dismiss();
If I understood it correctly, you want to dismiss the alert and cancel the timeout when the alert button is pressed, right? If so, you have to call clearTimeout(timeout); inside the button’s handler function. If you’re using Ionic 3:
Currently what is happening is when the button is not pressed it goes to the new page which I want but the alert is still on the new page, I do not want this part.
I want the alert to be removed from the new page when it goes on to it.