ng-animate not working with animate.css

巧了我就是萌 提交于 2019-12-13 05:14:13

问题


I have followed this tutorial trying to implement animation in my app. But for some reason I cant do it. Here is the planker I have made.

Here is how I am adding the ng-animate attribute:

<li ng-repeat="item in items" class="{enter:'animated bounceIn',leave:'animated bounceOut'}">{{item}}</li>

Note: I am using animate.css.

Can someone point out what am I doing wrong?


回答1:


Your animations aren't working because Angular applies some classes to the elements for the animations such as: ng-enter, ng-leave, etc. So, we just need to wire these up with the animations:

Here is an example:

<style>
 li.ng-enter {
-webkit-animation: bounceIn 0.5s;
animation: bounceIn 0.5s;
 }
 li.ng-leave {
   -webkit-animation: bounceOut 0.5s;
animation: bounceOut 0.5s;

 }
 </style>

In your html somewhere:

<li ng-repeat="item in items"  >{{item}}</li>

demo: http://plnkr.co/edit/c8uvhQXtXgdfsEHRo9P6?p=preview

The angular documentation lists the classes it uses.



来源:https://stackoverflow.com/questions/24686950/ng-animate-not-working-with-animate-css

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!