Skip to content

Animation doesn't work properly in nested component inside ng-content when both parent and child components use animations #32815

@yurikolesnikov

Description

@yurikolesnikov

🐞 bug report

Affected Package

@angular/animations

Is this a regression?

No.
It worked differently in versions < 5.0.0, but there were other problems with this case.

Description

A parent component has a ng-content which is located inside element with ngIf and animation.
parent: <div *ngIf="parentVisible" @animation><ng-content></ng-content></div>

Nested child component has additional ngIf with animation.
child: <div *ngIf="childVisible" @animation>Child content</div>

Usage: <parent><child></child></parent>

When parent component hides and shows back ng-content, the child's content inside ngIf element stays hidden.
This problem does not exist when animation is not used in parent or child component.

🔬 Minimal Reproduction

https://stackblitz.com/edit/angular-bugqv5

🌍 Your Environment

Angular Version:


8.2.7

Anything else relevant?
Tested in Chrome 77.0.3865.90 (64-bit), Firefox 69.0.1 (64-bit)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions