From 77682a3397ce83b4bef7d52d5fa20ea3639f1baf Mon Sep 17 00:00:00 2001 From: Tobias Bosch Date: Mon, 27 Feb 2017 11:23:37 -0800 Subject: [PATCH] fix(compiler): quote `animation` in `RendererTypeV2` and skip if empty (#14773) --- .../compiler/src/view_compiler_next/view_compiler.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/@angular/compiler/src/view_compiler_next/view_compiler.ts b/modules/@angular/compiler/src/view_compiler_next/view_compiler.ts index fcc6d6f141..4f3ca096c6 100644 --- a/modules/@angular/compiler/src/view_compiler_next/view_compiler.ts +++ b/modules/@angular/compiler/src/view_compiler_next/view_compiler.ts @@ -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(