M
M
mr_blond972018-04-19 16:32:34
Angular
mr_blond97, 2018-04-19 16:32:34

How in angular to animate a child element before the parent element starts the :leave animation?

In the element list example , when an element is removed, the element performs a :leave animation.
There is a div inside the element that needs to be animated so that when the element is removed from the list, the div's animation is played.
How to solve this problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-04-19
@mr_blond97

Probably worth using animateChild:

animations: [
  trigger('parentAnimation', [
    transition(':leave', [
      query('@itemAnim', [
        animateChild()
      ])
    ])
  ]),
  trigger('itemAnim', [
    transition(':enter', [
      animate(500)
    ]),
    transition(':leave', [
      group([
        animate('0.5s ease', style({ transform: 'translateY(-20%)', 'height':'0px' })),
        animate('0.5s 0.2s ease', style({ opacity: 0 }))
      ])
    ])
  ])
]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question