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:
@ -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();
|
||||
|
Reference in New Issue
Block a user