Staggering Angular2 animations within *ngFor

前端 未结 3 1719
南旧
南旧 2020-12-09 07:10

I\'ve been digging around the Angular2 documentation and there doesn\'t seem to be a simple way to add delays to animations. For reference, here is what I\'m aiming to achie

3条回答
  •  不思量自难忘°
    2020-12-09 07:30

    Since Angular 4.2.6 you can use query(), stagger() and animateChild() to stagger all kinds of animations. Here's an example:

    template: `
        
    {{item}}
    `, animations: [ trigger('fade', [ transition(':enter', [style({opacity: 0}), animate('.6s ease')]) ]), trigger('stagger', [ transition(':enter', [ query(':enter', stagger('.3s', [animateChild()])) ]) ]) ]

    Plunker: https://embed.plnkr.co/pQQSZETi7mnToB6lqfID/

提交回复
热议问题