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

Commit 7940fd0

Browse files
strillewesleycho
authored andcommitted
feat(modal): remove an unnecessary $digest
Optimized opening of modals by causing one digest loop less: The modalBackdrop directive now schedules switching its animate flag using a $timeout which does not cause a digest loop. If we assume modalBackdrop is always followed by a modalWindow directive, then we are guaranteed a digest loop by modalWindow's $timeout, which will happen after modalBackdrop's $timeout.
1 parent b076483 commit 7940fd0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: src/modal/modal.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,11 @@ angular.module('ui.bootstrap.modal', [])
6767

6868
scope.animate = false;
6969

70-
//trigger CSS transitions
70+
// schedule to trigger CSS transitions, but skip invoking apply immediately
71+
// (modalWindow's $timeout will invoke an apply which is enough since modalWindow is added after modalBackdrop)
7172
$timeout(function () {
7273
scope.animate = true;
73-
});
74+
}, 0, false);
7475
}
7576
};
7677
}])

0 commit comments

Comments
 (0)