I'm using Angular BrowserAnimations, but can't seem to actually trigger it.
My component animations are set to
animations: [
trigger('expandHide', [
state('expanded', style({
height: 'auto'
})),
state('hidden', style({
height: '20px'
})),
transition('* => expanded', [
animate('1s')
]),
transition('* => hidden', [
animate('0.25s')
])
])
]
And my template definition for the div I want to animate is
<div class="container" [@expandHide]="sheet.isExpanded ? 'expanded' : 'hidden'">
And yes, sheet.isExpanded
gets set in a neighboring div
with <div (click)="sheet.isExpanded = !sheet.isExpanded">
I would expect it to take 1s to expand in height, and 0.25s to collapse back down. However it just opens and closes immediately like without any transitions defined. How can I get this animation to work?