在ng-show动画结束时触发事件

时间:2015-02-18 22:21:23

标签: javascript angularjs animation ng-animate

我的AngularJS知识是原始的。在回答这个question on SO时,我查看了AngularJS文档,看看在fade-in动画完成后是否有任何事件触发。但是我没有找到任何。

我创建了一个Plunker,其中我在fade-out间隔5秒后调用一个方法。代码如下:

var myApp = angular.module('App',['ngAnimate']);
myApp.controller('MyController',['$scope','$timeout',function($scope,$timeout){
  $scope.showme = false;
  $scope.callAtTimeOut = function()
  {
    $scope.showme = false;
  }
  $scope.animateDiv = function(){
    $scope.showme = true;
    $timeout(function(){
      $scope.callAtTimeOut();
    }, 5000);
  }

}]);

有没有办法可以在没有硬编码5秒超时的情况下做到这一点?

我想我可以开始寻找某些CSS类来确定fade-in动画是否完整,但它保证创建directives

我认为AngularJS可能已经定义了一个在淡入动画结束时触发的内置事件。

请帮助我解决您的想法。提前致谢!

0 个答案:

没有答案