likeastore / ngDialog

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

Nested open and events #522

Closed Nachtfeuer closed 7 years ago

Nachtfeuer commented 7 years ago

What version of ng-dialog are you using? 0.6.4

What version of AngularJS are you using? 1.5.8

What browsers are affected? Not tested.

Please describe the issue Not sure whether it's an issue or wrong usage. Problem is that I open a dialog and inside that dialog I open again a dialog which works fine.

https://github.com/Nachtfeuer/concept-web-ui/blob/master/src/controller/story-controller.js#L64

However, oberserving that the dialog has been opened I'm sending the relating object (story) to the dialog. The controller for the dialog received the story:

https://github.com/Nachtfeuer/concept-web-ui/blob/master/src/controller/story-dialog-controller.js#L13

All fine so far.

Locally I have added a button in the dialog to add a task to the story which again open a dialog and now the problem ... the same event is triggered which has opened the story dialog resetting the dialog data.

What did you expect to happen? I need a way to distinct that an open event is for a concrete dialog. I can handle that - it seems - in a pre close callback which really can be assigned to a concrete dialog:

https://github.com/Nachtfeuer/concept-web-ui/blob/master/src/controller/story-controller.js#L68

What actually happened? Basically resetting first dialog.

I'm pretty sure that I'm doing it wrong but in your documentation I have not found the right way to do it. Maybe you could give me a hint?

Nachtfeuer commented 7 years ago

The only simple way I found is to use "data" and to give up the event handling otherwise I would have to organize the open/close states of the dialogs myself and that is what should be covered by this library.

So the feature request remains: provide a preOpenCallback as you did for preCloseCallback! Seems to be same request as #509