Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm trying to attach js-defined animations to the ng-class directive via the usual syntax using add and remove but the animations won't run. Logging reveals that the add and remove functions don't get called.

app.animation( ".bob", function () {

    return {
        add : function ( element, done ) {
            // Do add animation here and call done when done.
        },
        remove : function ( element, done ) {
            // Do remove animation here and call done when done.
        }
    }
} );

This usually works fine with other directives like ngIf with it's enter and leave animations, but with ngClass it only seems to work with css-animations as proved by the example in the documentation

share|improve this question

1 Answer 1

You need to be using addClass and removeClass not add/remove. Also you need three parameters (element, className, done) you are missing the second.

share|improve this answer
    
addClass, removeClass, setClass, beforeAddClass, beforeRemoveClass, beforeSetClass. –  matsko Apr 15 at 14:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.