Click away from an alert dismisses the alert

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?


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']
1 Like

@m_habib_ali yes its working thanks dear

Correct answer deprecated. In ionic 4 the property has changed to

backdropDismiss: false;