Javascript 不带jquery的$animate.addClass回调
我的angular项目中包含了jquery,下面的代码运行良好Javascript 不带jquery的$animate.addClass回调,javascript,angularjs,angularjs-directive,angular-ui,Javascript,Angularjs,Angularjs Directive,Angular Ui,我的angular项目中包含了jquery,下面的代码运行良好 scope.$watch('showWhen', function(newValue, oldValue) { if (newValue) { $animate.removeClass(element, 'ng-hide', scope.afterShow); } if (!newValue) { $animate.addClass(element, 'ng-hide', sc
scope.$watch('showWhen', function(newValue, oldValue) {
if (newValue) {
$animate.removeClass(element, 'ng-hide', scope.afterShow);
}
if (!newValue) {
$animate.addClass(element, 'ng-hide', scope.afterHide);
}
});
现在我已经删除了jquery,回调函数似乎没有被调用。我想这是因为它是一个jquery函数。在$animate文档中,我看不到任何说明可以传递回调函数的内容
有人知道如何仅使用angular来执行此操作吗?它没有回调,但返回承诺。你可以这样做:
$animate.removeClass(element, 'ng-hide').then(function() {
$scope.afterShow();
});
非常感谢。爱和承诺!