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

Commit

Permalink
fix(modal): defer promise resolution until animation starts
Browse files Browse the repository at this point in the history
- Defer resolution of modalInstance promise until the animation cycle starts
  • Loading branch information
wesleycho committed Jun 11, 2015
1 parent 988336c commit b8cd02d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/modal/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,10 @@ angular.module('ui.bootstrap.modal', [])
$modalStack.close = function (modalInstance, result) {
var modalWindow = openedWindows.get(modalInstance);
if (modalWindow && broadcastClosing(modalWindow, result, true)) {
modalWindow.value.deferred.resolve(result);
// Defer resolution until after modal window is closed - #3787
$timeout(function() {
modalWindow.value.deferred.resolve(result);
});
removeModalWindow(modalInstance, modalWindow.value.modalOpener);
return true;
}
Expand All @@ -334,7 +337,10 @@ angular.module('ui.bootstrap.modal', [])
$modalStack.dismiss = function (modalInstance, reason) {
var modalWindow = openedWindows.get(modalInstance);
if (modalWindow && broadcastClosing(modalWindow, reason, false)) {
modalWindow.value.deferred.reject(reason);
// Defer rejection until after modal window is dismissed - #3787
$timeout(function() {
modalWindow.value.deferred.reject(reason);
});
removeModalWindow(modalInstance, modalWindow.value.modalOpener);
return true;
}
Expand Down

0 comments on commit b8cd02d

Please sign in to comment.