diff --git a/packages/compiler/src/template_parser/binding_parser.ts b/packages/compiler/src/template_parser/binding_parser.ts index 5066b7757c..ae6b29e159 100644 --- a/packages/compiler/src/template_parser/binding_parser.ts +++ b/packages/compiler/src/template_parser/binding_parser.ts @@ -219,7 +219,7 @@ export class BindingParser { // This will occur when a @trigger is not paired with an expression. // For animations it is valid to not have an expression since */void // states will be applied by angular when the element is attached/detached - const ast = this._parseBinding(expression || 'null', false, sourceSpan); + const ast = this._parseBinding(expression || 'undefined', false, sourceSpan); targetMatchableAttrs.push([name, ast.source !]); targetProps.push(new BoundProperty(name, ast, BoundPropertyType.ANIMATION, sourceSpan)); } diff --git a/packages/core/test/animation/animation_integration_spec.ts b/packages/core/test/animation/animation_integration_spec.ts index 2888437206..72133a8515 100644 --- a/packages/core/test/animation/animation_integration_spec.ts +++ b/packages/core/test/animation/animation_integration_spec.ts @@ -2599,6 +2599,43 @@ export function main() { fixture.detectChanges(); expect(getLog().length).toEqual(1); }); + + it('should treat the property as true when the expression is missing', () => { + @Component({ + selector: 'parent-cmp', + animations: [ + trigger( + 'myAnimation', + [ + transition( + '* => go', + [ + style({opacity: 0}), + animate(500, style({opacity: 1})), + ]), + ]), + ], + template: ` +