Home  >  Q&A  >  body text

angular.js - angularjs ng-animate在ng-repeat情况下不起作用问题

想要达到ng-repeat时ng-enter,ng-leave时延迟或者一些背景动画的显示,进一步使用ng-enter-stagging,让多项不同时显示出来,但是在ng-repeat构建列表时动画都没有展示。查不到问题,找了很多demo来试,都没有办法。
下面是HTML代码:

<pre>
<p ng-repeat="item in items" class="repeated-item">
  {{ item}}
</p>
</pre>

下面是css代码:

.repeated-item{
    border: solid 1px;
    opacity: 1;
    transition:3s linear all;
}
/*动画开始前*/

.repeated-item.ng-enter, .repeated-item.ng-move {
  -webkit-transition:3s linear all;
  -moz-transition:3s linear all;
  -o-transition:3s linear all; 
  background-color: red;
  opacity:0;
}

试过把动画加到.repeated-item上去,还是不起效。请各位老师帮忙解答一下!麻烦大家了!

PHP中文网PHP中文网2714 days ago524

reply all(3)I'll reply

  • 迷茫

    迷茫2017-05-15 17:07:04

    Are you sure your transition is correct? How do I see the syntax is:

    Then it should be:

    .repeated-item{
        border: solid 1px;
        opacity: 1;
        transition: all 3s linear;
    }

    reply
    0
  • 高洛峰

    高洛峰2017-05-15 17:07:04

    Same question, please ask God

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-15 17:07:04

    The animation of repeat is created from scratch. Add a button and write the data into items and you should be able to have animation

    reply
    0
  • Cancelreply