How to write the countdown in the pop-up window by ionic3

There is a confirmation on the

page. After clicking, a pop-up window pops up. There is no button pop-up window

clipboard.png

clipboard.png

defines a countdown, which works normally.
but in the pop-up window, this number does not change
code:
export class InteglePage {
public flag = true;
public num = 5;
constructor (public navCtrl: NavController, public navParams: NavParams, public alertCtrl: AlertController, public actionSheetCtrl: ActionSheetController) {
}

/ / countdown
shi () {

var countDown = document.getElementById("countDown");
console.log(countDown);
var timer = setInterval(() => {
  --this.num
  console.log(this.num);
  if (this.num <= 0) {
    clearInterval(timer)
  }
}, 1000);

}

`
agree () {

   this.shi();
    const confirm = this.alertCtrl.create({
          title: `<i class="icon iconfont"></i>`,
          message: `
              
              <h3></h3>
              

<span id="countDown">${this.num}</span>

`, cssClass: "clickAgree", }) confirm.present(); setTimeout((data) => { confirm.dismiss(() => { console.log("dismissed") }) }, 5000); }

`

Nov.16,2021

hide and re-invoke the native writing of


each time you update, and get the dom element, the element .innerHTML = num,.
Thank you

very much.
Menu