$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();
});
}
}
}
]);