角度动画removeClass不起作用

时间:2015-10-27 11:58:33

标签: angularjs removeclass ng-animate

$animate.removeClass无法添加visible-remove&删除visible-remove-active课程期间的visible个班级。虽然,$animate.addClass工作正常。

angular.module('myApp').directive('myDir', [
    '$rootScope',
    '$animate',
    function ($rootScope, $animate) {
        return {
            restrict: 'A',
            link: function ($scope, element) {

                $rootScope.$on('someEvent', function (event, showMenu) {
                    if (showMenu) {
                        $animate.addClass(element, 'visible');
                    }
                    else {
                        $animate.removeClass(element, 'visible');
                    }
                    $scope.$apply();
                });
            }
        }
    }
]);

0 个答案:

没有答案
相关问题