Does anyone know if they is a way that if an alert goesf do not show another alert even if the if statement true for a minute. Is this possible. So it shows alert currently but if I click out of alert shows 20 more alerts as threshold met.
post with more details and share your alert code.
So what occurs when it goes over 3 it creates numerous alerts rather than just create one. so when I click disagree it gets rid of first alert but show another one straight away, Could show 10s of alerts breaking the app. I just want show one alert. Is there anyway to code this or even if alert shows don’t show another one for a minute.
if (this.dist >=3) {
let timeout;
const alert = this.alertCtrl.create({
title: 'S',
subTitle: '?',
buttons: [{
text: 'Disagree',
handler: () => {
console.log('Disagree clicked');
clearTimeout(timeout);
}
},
{
text: 'Agree',
handler: () => {
alert.dismiss();
// this.navCtrl.push('SmsPage');
clearTimeout(timeout);
console.log('Agree clicked');
}
}
]
});
alert.present();
timeout = setTimeout(() => {
alert.dismiss();
}
};
By any chance, are you calling it in a loop?
Nope just if I disagree the dist could be still over 3 so shows loads of alerts like 20 as dist could be over 3. Any way to just show alert once as it crashes app as shows way too many alerts.