使用
entry
/
leave
转变:
TS文件中的动画:
animations: [
trigger(
'detailExpand', [
transition(':enter', [
style({ height: '0px', minHeight: '0', display: 'none' }),
animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)', style({ height: '*' }))
]),
transition(':leave', [
style({ height: '*' }),
animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)', style({ height: '0px', minHeight: '0', display: 'none' }))
])
]
)
]
在模板中使用它:
<my-inner-component *ngIf="myModel.isExpanded" [@detailExpand]>
...
</my-inner-component>