3

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

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

1 Comment

addClass, removeClass, setClass, beforeAddClass, beforeRemoveClass, beforeSetClass.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.