I am new to using ng-animate with AngularJS 1.2. I am not sure why my ng-animate does not work a certain class name but works with the default for a simple fade in that I saw in an example.
In this example, I try to set my ng-animate class to be 'animation': http://plnkr.co/edit/QWQUUVdcLmzLKRvVibqN?p=preview
but when I use the default, and my class name for animations is just ".ng-enter" and ".ng-leave", the fade in animation seems to work fine.
http://plnkr.co/edit/lEQhMwd6RWmsdmJbosu0?p=preview
Any help would be greatly appreciated, thanks!
Also important to remember to add the animation module as a dependency to your module definition. Just in case anyone else is having problems getting animations working and hasn't done this.
As Tasse said ng-animate is deprecated, we need to use the class. If you are copying CSS from angularjs web site http://www.nganimate.org/angularjs/ng-repeat/move then you need to modify those CSS in a particular format
For complete detail check Apply Angularjs Animation in 2 minutes
This is in addition to accepted answer, for those who are trying to animate an element with
ng-show
directive. These are styles which must be used:Please note, not all angular directives adds
ng-enter, ng-enter-active, ng-leave and ng-leave-active
. For example,ng-show
directive addsng-hide-remove
at the beginning of animation andng-hide-remove-active
at the end of it. For more details follow this link: https://www.w3schools.com/angular/angular_animations.aspYou must check that the version of your angular.min.js matches with the version of angular-animate.min.js.
I got mine fixed this way.
The ng-animate attribute is deprecated in 1.2.
In 1.2 you define the appropriate CSS classes using a special naming convention. If you want a specific name like 'animation', you need to add that class to the element you want to animate.
As long as you have the correct CSS classes, some directives will be animated automatically. Which ones can be found here: http://docs.angularjs.org/api/ngAnimate
This is the reason your animation works in your second example when just defining the ".ng-enter" class. This would however automatically animate all directives that support the enter animation.
I have updated your first example to make it work with the class named 'animation':
HTML:
CSS (Keeping selectors ungrouped for clarity):
Plunker: http://plnkr.co/edit/J0qJEMmwdzqXzu733fJf?p=preview