寻找在ng-animate上“输入”前执行内容的方法,如beforeAddClass

时间:2016-04-27 15:11:21

标签: javascript angularjs animation

//this top animation is what I have seen and was hoping to find a way to do with enter-leave below

app.animation('.answer-animation', function(){
  return {
    beforeAddClass: function(element, className, done){
      if (className == 'answer') {
         console.log('stuff todo beforeAddClass');
      }
      else {
        done();
      }
    },

    beforeRemoveClass: function(element, className, done) {
      if (className == 'answer') {
        console.log('stuff todo beforeRemoveClass');
      }
      else {
        done();
      }
    }
  };
  
  /*what I am trying to do below*/
  app.animation(".viewAnimation", function ($anchorScroll, $timeout) {
	return {
   //***********would like to do something before enter
    	enter: function(element, done) {
				},
		leave: function(element, done) {
			    }
		};
	});

  

嗨,我正在寻找一种方法来挂钩角度生命周期,类似于可用于ng-hide的beforeAddClass。对于我的,我有一个视图动画,在进入之前,我想做点什么。在“输入”执行之前,我没有找到或者无论如何都可以执行某些操作。我该怎么做呢?

1 个答案:

答案 0 :(得分:0)

尝试angular docs

中的ng- [event] -prepare类