I had an edge-case issue where the confirm popup was blocking my JS thread mid-digest and I was getting an error in IE11.
It happened when clicking a button with ng-click to trigger navigation / state change.
Wrapping this in a setTimeout did the trick
// allow any existing scope digest to complete
setTimeout(function () {
if (!confirm(unsavedWarningsConfig.navigateMessage)) {
unsavedWarningsConfig.log("user wants to cancel leaving");
event.preventDefault(); // user clicks cancel, wants to stay on page
} else {
unsavedWarningsConfig.log("user doesn't care about loosing stuff");
$rootScope.$broadcast('resetResettables');
}
});
Also I change the scope.$apply used in the unsavedWarningForm directive for a $timeout which is safer.
I had an edge-case issue where the
confirm
popup was blocking my JS thread mid-digest and I was getting an error in IE11.It happened when clicking a button with
ng-click
to trigger navigation / state change.Wrapping this in a
setTimeout
did the trickAlso I change the
scope.$apply
used in theunsavedWarningForm
directive for a$timeout
which is safer.