I’m trying to show an alert with a live update 10 sec countdown in the title.
But it only shows the initial value from when the alert is called.
Here’s the code:
// Class property
time:number;
// Method code
this.time = 10;
const that = this;
const alert = this.alertCtrl.create({
title: this.time
});
const count = setInterval(function(){
--that.time;
if(that.time == 0){
alert.dismiss();
clearInterval(count);
}
},1000);
alert.present();