This stackblitz demonstration showcases an animation where clicking on Create success
causes the components view to smoothly transition from opacity 0 to opacity 1 over a duration of 5 seconds.
If we clear the container using this.container.clear()
, the removal of the element is not animated. The animations attribute in the code snippet below controls this behavior:
animations: [
trigger('fadeInOut', [
transition(':enter', [
style({ opacity: 0 }),
animate(5000, style({ opacity: 1 }))
]),
transition(':leave', [
animate(5000, style({ opacity: 0 }))
])
])
],
How can we ensure that the leave
animation is triggered in this scenario?