P
P
Pantene7422018-08-13 15:28:10
Angular
Pantene742, 2018-08-13 15:28:10

How to animate a changing variable or array in Angular 2+?

We need to animate the change in the bound variable in {{ ... }}.
The array of records passed to the component via @Input also changes and I don’t know how to animate the opacity of the change.
It turns out with the code that appears on the page, but I can’t find examples to change the content.
Here I use [fadeInOut] when the code will appear with [ngComponentOutlet]. We must also do to change the array printed via *ngFor. (I suppose that it is necessary to somehow pull the trigger programmatically to change the data received via @Input ) Please give links to good articles. Or tell me how to google it.

animations: [
    trigger('fadeInOut', [
      transition(':enter', [
        // :enter is alias to 'void => *'
        style({ opacity: 0 }),
        animate(900, style({ opacity: 1 }))
      ])
    ])
  ]

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question