Angular animations


#1

Hi , Does angular “leave” animations only works with *ngIf ?? I am trying to implement animations to a card on dismissal (when user clicks on cancel button present on the card) with *ngFor . Don’t want to use *ngIf for this. How to achieve this??


#2

which animation are you talking about?


#3

I am talking about :leave animations in *ngFor. That’s not working for me.


#4

It works any time the DOM element is removed. You don’t have to remove with ngIf.
You might, for example, be doing an <ion-item [@myRemoveAnim] *ngFor="item of items">...</ion-item> and in your TS if you do a splice on some this.items it will be removed from the DOM and will animate.