How to delay ngAnimate in ngRepeat

前端 未结 2 970
滥情空心
滥情空心 2021-01-30 23:31

When using ngAnimate to fade in each item in ngRepeat, currently all items fade in at the same time. Is it possible for each item to fade in after the previous item has faded to

2条回答
  •  太阳男子
    2021-01-31 00:09

    This is now supported natively with 1.2: https://docs.angularjs.org/api/ngAnimate#css-staggering-animations

    To make use of it, use the ng-enter-stagger selector in your CSS, like so:

    css:

    .animated.ng-enter-stagger {
      transition-delay: 0.3s;
      animation-delay: 0.3s;
    }
    

    sass (if in use):

    =stagger($delay)
      &-stagger
        transition-delay: $delay
        animation-delay: $delay
    
    .animated
      &.ng-enter
        +stagger(0.3s)
    

提交回复
热议问题