Ionic Alert: wait until button is pressed


#1

Hi, I have a class Action with it’s method do() wherein the IonicAlert is called.
What I want to do now is, that I call something like
Action.do().then( () => { /* do domething */ } );
but only after OK was clicked on the alert.

do(): Promise<boolean> {

    let alert = this.alertCtrl.create({
      buttons: [{
        text: 'OK',
        handler: () => {
          alert.dismiss().then( () => { /* do something */ });
          return false;
        }
      }]
    });

    alert.present();
    return null;
  }
}

I added return null; only to get no error, but of course it’s not working.
Any idea, how to solve this? Thanks