fix(compiler): quote `animation` in `RendererTypeV2` and skip if empty (#14773)

This commit is contained in:
Tobias Bosch 2017-02-27 11:23:37 -08:00 committed by Igor Minar
parent 213e210a93
commit 77682a3397
1 changed files with 7 additions and 3 deletions

View File

@ -42,6 +42,12 @@ export class ViewCompilerNext extends ViewCompiler {
const statements: o.Statement[] = [];
const customRenderData: o.LiteralMapEntry[] = [];
if (component.template.animations && component.template.animations.length) {
customRenderData.push(new o.LiteralMapEntry(
'animation', convertValueToOutputAst(component.template.animations), true));
}
const renderComponentVar = o.variable(rendererTypeName(component.type.reference));
statements.push(
renderComponentVar
@ -49,9 +55,7 @@ export class ViewCompilerNext extends ViewCompiler {
new o.LiteralMapExpr([
new o.LiteralMapEntry('encapsulation', o.literal(component.template.encapsulation)),
new o.LiteralMapEntry('styles', styles),
new o.LiteralMapEntry('data', o.literalMap([
['animation', convertValueToOutputAst(component.template.animations)]
])),
new o.LiteralMapEntry('data', new o.LiteralMapExpr(customRenderData))
])
]))
.toDeclStmt(