【发布时间】:2015-06-13 15:59:52
【问题描述】:
添加className完成动画后如何在angular中回调函数调用?
这是我的代码:
var myApp = angular.module('myApp', []);
myApp.controller('count', function($scope) {
$scope.animate = function () {
$('h2').addClass('fade'); //adding animation 1s
//opcity done how to put a call back?
$scope.done = function () { //call after 1s..?
console.log('done');
}
}
});
<div class="container" ng-app="myApp">
<div class="content" ng-controller="count">
<h1 ng-click="animate()">Click ME</h1>
<h2>Let me Fade</h2>
</div>
</div>
【问题讨论】:
-
我所知道的是 jquery 无法捕捉到 css 中发生的动作 .. 所以你不能通过 addClass 来检查
-
好的,你能告诉我正确的方法吗? - 更新我的小提琴