fix(animations): always trigger animations after the change detection check (#12713)

This patch ensures that animations are run outside of change detection
thus allowing for start and done callbacks to modify application data
without causing a cycle loop.

Closes #12713
This commit is contained in:
Matias Niemelä
2016-11-04 15:15:27 -07:00
committed by vikerman
parent 2a3f4d7b17
commit 383f23b578
2 changed files with 43 additions and 2 deletions

View File

@ -17,6 +17,15 @@ export function queueAnimation(player: AnimationPlayer) {
/** @internal */
export function triggerQueuedAnimations() {
// this code is wrapped into a single promise such that the
// onStart and onDone player callbacks are triggered outside
// of the digest cycle of animations
if (_queuedAnimations.length) {
Promise.resolve(null).then(_triggerAnimations);
}
}
function _triggerAnimations() {
for (var i = 0; i < _queuedAnimations.length; i++) {
var player = _queuedAnimations[i];
player.play();