Click away from an alert dismisses the alert


#1

Hello, I have a prompt alert where I need a user to add some text.

My problem is that I realized that if the user clicks away from the alert, the alert disappears. Is there any way of avoiding this?

Thanks.


#2

Hi @RaulGM, you just need to set “enableBackdropDismiss” to false to disable its dismiss on clicking outside of alert area. like this !

showAlert() {
    let alert = this.alertCtrl.create({
      title: 'New Friend!',
      enableBackdropDismiss: false,
      subTitle: 'Your friend, Obi wan Kenobi, just accepted your friend request!',
      buttons: ['OK']
    });
    alert.present();
  }

#3

@m_habib_ali yes its working thanks dear