likeastore / ngDialog

Modals and popups provider for Angular.js applications
http://likeastore.github.io/ngDialog
3.14k stars 692 forks source link

Is there a way to have a confirmation modal only when the ngDialog is closed by clicking on the overlay or pressing ESC? #565

Open Riccardo-Andreatta opened 7 years ago

Riccardo-Andreatta commented 7 years ago

Hi, I am using ngDialog version 1.3.0 with AngularJS 1.6.4.

I know about the options that are preventing the closure of the dialog by clicking the overlay or the ESC key

closeByDocument: false,
closeByEscape: false,

but what I am trying to do is a modal that alert the user if they are trying to close the dialog when they have already typed something in the form that is inside the first dialog.

This example may explains better what I would like to do: https://plnkr.co/edit/SzmNd0hqoTEoxZX7HPIS?p=preview

Basically, I would like that if the user click elsewhere or try to close the modal the alert is shown (like the example is doing), but if he tries to submit the form, the alert should not be shown.

Is it possible to do it? Is there already a functionality that is doing this?