-
Notifications
You must be signed in to change notification settings - Fork 27k
Closed
Labels
area: coreIssues related to the framework runtimeIssues related to the framework runtimecore: animationsIssues related to `animate.enter` and `animate.leave`Issues related to `animate.enter` and `animate.leave`state: has PR
Milestone
Description
Which @angular/* package(s) are the source of the bug?
Don't known / other
Is this a regression?
No
Description
This code is supposed to hide the .box when Toggle is clicked. It will not hide. It will animate out as expected, but then reappear.
2025-10-19.18.40.57.mov
The following things must be true for the issue to exist, otherwise there is no problem:
animate.leavemust be present.- The component must be nested.
provideAnimationsAsyncmust be configured.- The parent or a container's sibling
@Componentmust haveanimations, even if empty.
I'm using signals in the example, but it works with ordinary properties too.
import { Component, signal } from '@angular/core';
@Component({
selector: 'app-container',
template: `
<button (click)="visible.set(!visible())">Toggle</button>
@if (visible()) {
I will hide
<div class="box" animate.leave="leave">And I won\'t</div>
}
`,
styles: [`
.box {
background: red;
}
@keyframes fade-out {
from { opacity: 1; }
to { opacity: 0; }
}
.leave { animation: fade-out 1000ms; }
`],
})
export class Container { // <-- Must be nested
readonly visible = signal(true);
}
@Component({
selector: 'app-root',
template: `<app-container />`,
imports: [
Container,
],
animations: [], // <-- Necessary to break things
})
export class App {
}Please provide a link to a minimal reproduction of the bug
https://studio.firebase.google.com/animate-leave-27515706
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run ng version)
@angular-devkit/architect 0.2003.6
@angular-devkit/core 20.3.6
@angular-devkit/schematics 20.3.6
@schematics/angular 20.3.6
rxjs 7.8.2
typescript 5.9.3
zone.js 0.15.1
Anything else?
Why is this important?
I was using PrimeNg and had <p-confirmDialog /> in one of the root components. It had some animations defined and it was breaking animate.leave in one of my components.
The library and this pattern is quite common and when you encounter the issue it's hard to understand what the problem is.
Metadata
Metadata
Assignees
Labels
area: coreIssues related to the framework runtimeIssues related to the framework runtimecore: animationsIssues related to `animate.enter` and `animate.leave`Issues related to `animate.enter` and `animate.leave`state: has PR