Skip to content

animation.leave host class issue #63418

@ErsinCabuk

Description

@ErsinCabuk

Which @angular/* package(s) are the source of the bug?

core

Is this a regression?

No

Description

When using ViewContainerRef#createEmbeddedView with an ng-template that contains ng-content, the class applied via animate.leave on Component.host is unexpectedly re-applied. This happens after destroying the ng-template from the ViewContainerRef and creating it again.

There is a more descriptive example in the repo I provided via StackBlitz.

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/stackblitz-starters-nrjxyft2

Please provide the exception or error you saw


Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 20.2.0
Node: 22.18.0
Package Manager: npm 11.5.2
OS: win32 x64


Angular: 20.2.1
... common, compiler, compiler-cli, core, forms
... platform-browser, router

Package                      Version
------------------------------------
@angular-devkit/architect    0.2002.0
@angular-devkit/core         20.2.0
@angular-devkit/schematics   20.2.0
@angular/build               20.2.0
@angular/cli                 20.2.0
@schematics/angular          20.2.0
rxjs                         7.8.2
typescript                   5.9.2

Anything else?

No response

Metadata

Metadata

Labels

area: coreIssues related to the framework runtimecore: animationsIssues related to `animate.enter` and `animate.leave`

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions