Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit b8cd02d

Browse files
committed
fix(modal): defer promise resolution until animation starts
- Defer resolution of modalInstance promise until the animation cycle starts
1 parent 988336c commit b8cd02d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: src/modal/modal.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,10 @@ angular.module('ui.bootstrap.modal', [])
324324
$modalStack.close = function (modalInstance, result) {
325325
var modalWindow = openedWindows.get(modalInstance);
326326
if (modalWindow && broadcastClosing(modalWindow, result, true)) {
327-
modalWindow.value.deferred.resolve(result);
327+
// Defer resolution until after modal window is closed - #3787
328+
$timeout(function() {
329+
modalWindow.value.deferred.resolve(result);
330+
});
328331
removeModalWindow(modalInstance, modalWindow.value.modalOpener);
329332
return true;
330333
}
@@ -334,7 +337,10 @@ angular.module('ui.bootstrap.modal', [])
334337
$modalStack.dismiss = function (modalInstance, reason) {
335338
var modalWindow = openedWindows.get(modalInstance);
336339
if (modalWindow && broadcastClosing(modalWindow, reason, false)) {
337-
modalWindow.value.deferred.reject(reason);
340+
// Defer rejection until after modal window is dismissed - #3787
341+
$timeout(function() {
342+
modalWindow.value.deferred.reject(reason);
343+
});
338344
removeModalWindow(modalInstance, modalWindow.value.modalOpener);
339345
return true;
340346
}

0 commit comments

Comments
 (0)