如何在离子性弹出确认按钮单击时返回布尔值?

时间:2019-04-13 04:54:58

标签: ionic-framework

当我调用this.AlertProvider.presentConfirm()时,单击确认按钮上会出现一个离子弹出确认窗口,我想返回true / false

presentConfirm() {
    let alert = this.alertCtrl.create({
      title: 'Confirm Activate',
      message: 'Do you want to Disable',
      buttons: [
        {
          text: 'Cancel',
          role: 'cancel',
          handler: () => {
            console.log('Cancel clicked');
          }
        },
        {
          text: 'Confirm',
          handler: () => {
            console.log('submit clicked');
          }
        }
      ]
    });
    alert.present();
}
var confirm_value = this.AlertProvider.presentConfirm();
alert(confirm_value);

0 个答案:

没有答案