jameskleeh / angular-confirm

Confirmation modal dialog for AngularJS
Apache License 2.0
150 stars 75 forks source link

Add onOpen and onDismiss handlers to directive #71

Open jmwohl opened 8 years ago

jmwohl commented 8 years ago

Adds a couple important missing options to the directive:

@Schlogen - Please consider these changes, as they are required for our application! I didn't commit the minified file, happy to do that if you like.

jameskleeh commented 8 years ago

What is the use case for onOpen ?

The onDismiss option really only makes sense while it is being used as a directive. You can simply change to use $confirm directly and handle the .then how you want.

jmwohl commented 8 years ago

Right, both options are for the directive — neither are necessary using the service directly. We switched to the directive from the service in order to clean up the logic in our app a bit, keeping user-facing messaging in the markup. Is there any reason to prevent the handling of confirmation dismissal via the directive?

The onOpen hook is useful when there are UI updates that need to happen which correspond to the opening of the dialog. Specifically, in our case we're sometimes triggering the dialog from a popover, and we need the popover to close when the confirm dialog opens.