My CSS animated property is functioning properly with the code snippet below:
animation: collapse1 0.3s forwards;
However, I now need to transition to Angular animations. Everything is working correctly, except for one issue: once the animation completes, it reverts back to its initial state.
The current behavior looks like this:
animation: collapse1 0.3s;
When it should function like this:
animation: collapse1 0.3s forwards;
In essence, my question is whether it's possible to apply animation-fill-mode in Angular? My framework version is Angular 6.
For a demo, visit: https://stackblitz.com/edit/angular-uw3o6u
The demo includes 2 buttons.
The animation works as intended when the user hovers over the button (using :hover css). However, I want the same behavior when the user clicks on the button (case 2).
After clicking the button, the final position should be like this:
https://i.sstatic.net/X4TnG.png
Instead, it reverts back to the starting point:
https://i.sstatic.net/jgLTE.png
I managed to address this by utilizing CSS classes: https://stackblitz.com/edit/angular-kdfgxw
However, this solution doesn't utilize Angular animations.
If anyone knows how to resolve this using Angular animations, please let me know. Is it even feasible?