Anyone able help this frustrating issue. I have simple if statement and the alert works fine but const alert = this.alertCtrl.create({ doesn’t show up on screen for some reason.
First code alert shows but second code doesn’t.
var a = 1
if (a ==1){
alert('testi')
}
if (a ==1){
let timeout;
const alert = this.alertCtrl.create({
title: 'Alert',
subTitle: 'test alert',
buttons: [{
text: 'Disagree',
handler: () => {
console.log('Disagree clicked');
clearTimeout(timeout);
}
},
{
text: 'Agree',
handler: () => {
alert.dismiss();
// this.navCtrl.push('TestPage');
clearTimeout(timeout);
console.log('Agree clicked');
}
}
]
});
}