fix(animations): ensure all child elements are rendered before running animations

Closes #9402
Closes #9775
This commit is contained in:
Matias Niemelä
2016-07-01 16:01:57 -07:00
parent 7073cf74fe
commit cbe85a0893
20 changed files with 283 additions and 81 deletions

View File

@ -271,7 +271,7 @@ class _AnimationBuilder implements AnimationAstVisitor {
statements.push(_ANIMATION_FACTORY_VIEW_VAR
.callMethod(
'registerAndStartAnimation',
'queueAnimation',
[
_ANIMATION_FACTORY_ELEMENT_VAR, o.literal(this.animationName),
_ANIMATION_PLAYER_VAR

View File

@ -8,6 +8,7 @@
import {EMPTY_STATE as EMPTY_ANIMATION_STATE, LifecycleHooks, isDefaultChangeDetectionStrategy} from '../../core_private';
import * as cdAst from '../expression_parser/ast';
import {Map} from '../facade/collection';
import {isBlank, isPresent} from '../facade/lang';
import {Identifiers} from '../identifiers';
import * as o from '../output/output_ast';
@ -36,6 +37,8 @@ function createCurrValueExpr(exprIndex: number): o.ReadVarExpr {
return o.variable(`currVal_${exprIndex}`); // fix syntax highlighting: `
}
var _animationViewCheckedFlagMap = new Map<CompileView, boolean>();
function bind(
view: CompileView, currValExpr: o.ReadVarExpr, fieldExpr: o.ReadPropExpr,
parsedExpression: cdAst.AST, context: o.Expression, actions: o.Statement[],
@ -171,6 +174,12 @@ function bindAndWriteToRenderer(
animation.fnVariable.callFn([o.THIS_EXPR, renderNode, oldRenderValue, emptyStateValue])
.toStmt());
if (!_animationViewCheckedFlagMap.get(view)) {
_animationViewCheckedFlagMap.set(view, true);
view.afterViewLifecycleCallbacksMethod.addStmt(
o.THIS_EXPR.callMethod('triggerQueuedAnimations', []).toStmt());
}
break;
}