Animating a div by hiding/showing it with *ngIf

Hey there,

I’m trying to animate a div, by making it slide down and up when expanding/minimising it.
my code:


when the toggle button is clicked:
toggle() {
if(this.toggleIcon === ‘add-circle’) {
this.toggleIcon = ‘remove-circle’;
} else {
this.toggleIcon = ‘add-circle’;

now this makes it jump really quickly up and down. but I want it to be a smooth transition, is there a way of doing this?

1 Like