Add support for usage within Modal Dialogs
I am using the UI Booststrap Modals.
Currently if multiple forms exist but some of them are contained within Modal Dialogs there are the following problems:
- The modal exit/close/dismiss events are not detectable by the unsavedChanges framework.
- If a change has occured in a layer underneath, all forms in modal dialogs above will complain about unsaved changes.
One solution could be to add an additional directive ( or a priority attribute). Instead of using a flat array of forms inside Unsaved Changes, it could be possible to have a priority queue of forms where the following applies:
-if all forms have same priority all forms are checked. -Otherwise, get forms of same highest priority and only check those. -Once the appropriate save/dismiss etc actions are taken, remove the forms from the queue/data structure so they are not further checked.
This is just an idea for a possible solution.
Finally, within my own code I am currently using the following in the cancel function which is a bit annoying:
@cancel = ->
checkUnwantedNavigation = (unsavedWarningSharedService.confirmExit()) # will return undefined/null if form is not dirty
if (!$scope.assessForm.$dirty || confirm(checkUnwantedNavigation)) #this is annoying, should be able to specify priority in the directive
$modalInstance.dismiss()