Reputation: 2418
I have simple function in directive link which is calling
$animate.addClass(element, 'wrong')
and then animation .wrong
m.animation ".wrong", ["$timeout",($timeout)->
removeClass: (element, className)->
console.log "remove"
angular.noop()
addClass: (element, className) ->
console.log "add"
$timeout(->
element.removeClass(className)
,
500
)
return
on first run is added class right and called addClass fn in animation. But on second time is just added class but not called addClass fn. Also removeClass fn is never called.
// CODE IS IN COFFEESCRIPT
// WHEM PLUNKER WILL BE WORKING I'LL PROVIDE EXAMPLE
Upvotes: 0
Views: 468
Reputation: 1049
You need to call done()
in your animations in order to remove ng-animate
so you can change the animations. If you don't call done(), Angular thinks your animation is still running.
.animation(".wrong", function(){
return {
addClass: function(element, className, done){
done();
},
removeClass: function(element, className, done){
done();
}
};
})
Upvotes: 2