Once the user clicks through the unsaved data warning, clear the warning
for future navigation. If more fields are changed, the warning will be
reinstated.
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
// handle page change
$($window).on('beforeunload', function() {
+ service.clear();
return msg || egStrings.EG_UNLOAD_PAGE_PROMPT_MSG;
});
// similar to the page-page prompt.
service.locChangeCancel =
$scope.$on('$locationChangeStart', function(evt, next, current) {
- if (!confirm(msg || egStrings.EG_UNLOAD_CTRL_PROMPT_MSG))
+ if (confirm(msg || egStrings.EG_UNLOAD_CTRL_PROMPT_MSG)) {
+ // user allowed the page to change.
+ // Clear the unload handler.
+ service.clear();
+ } else {
evt.preventDefault();
+ }
});
};