我在一些地方使用了ngAnimate,但它接管了所有ng-class元素的动画。我已经为各种元素编写了大量的动画代码,我不需要ngAnimate来接管。他们增加的课程似乎真的把事情搞砸了。排除这些元素?
这是我想要排除的元素:
<div ng-class="myclass"></div>
ngAnimate添加像
这样的类$scope.myclass = 'move'
<div class="move-add" ng-class="myclass"></div>
我在IRC上得到了jaawerth的帮助。他/她引导我到这个链接:
https://github.com/angular/angular.js/issues/5172并建议我写这个指令:
.directive('noAnimate', ['$animate',
function($animate) {
return {
restrict: 'A',
link: function(scope, element, attrs) {
$animate.enabled(false, element)
scope.$watch(function () {
$animate.enabled(false, element)
})
}
};
}
])
解决了问题