I have added Enter and Leave animation in my Angular component. Where I am animating the height of a div based on a boolean variable. The animation is working fine but Is there a way to turn off animation on the initial view load?
Component.ts
animations: [
trigger('slideInOut', [
transition(':enter', [
style({ height: '0', overflow: 'hidden', opacity: 0 }),
animate('200ms ease-in-out', style({ height: '*', opacity: 1 }))
]),
transition(':leave', [
animate(
'200ms ease-in-out',
style({ height: 0, overflow: 'hidden', opacity: 0 })
)
])
])
]
Component.html
<div class="sidebar-sub-menu" *ngIf="isSubMenuOpen || setSubmenuActive" [@slideInOut]>
...
</div>