I have a case where I have an inner menu which is rendered by ngIf, in this menu I have switch cases. I tried to make an animation (that works in other projects) but not here, only the enter event is happening, the leave event is not fired, the content just disappears.
I tried to put the animation on each switch case but it didn't work as well also tried fade animation, same result
export let slideDown2 = trigger('slideDown2', [
transition(':enter', [
style({
height: 0,
paddingTop: 0,
paddingBottom: 0,
}),
animate(300)
]),
transition(':leave', [
style({
height: '*',
paddingTop: '*',
paddingBottom: '*',
}),
animate(300)
]),
export let fadeInAnimation = animation([
style({ opacity: 0 }),
animate('{{ duration }} {{ easing }}')
], {
params: {
duration: '300ms',
easing: 'ease-out'
}
});
export let fade = trigger('fade', [
transition(':enter',
useAnimation(fadeInAnimation)
),
transition(':leave', [
animate(200, style({ opacity: 0 }))
])
])
;
<div *ngIf="filter.isExpanded"
class="MenuesContainer"
[ngSwitch]="filter.title"
(click)="$event.stopPropagation()"
[class.changePosition] = "openedTab > 2"
@slideDown2
>
<div *ngSwitchCase="'Salon Services'" class="innerMenu servicesFilter">
//// content///
</div>
<div *ngSwitchCase="'Add-On Services'" class="innerMenu" >
//// content///
</div>
<div *ngSwitchCase="'Distance'" class="innerMenu distanceFilter" >
//// content///
</div>
</div>