문제

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

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top