angular.Module.animation()

animation(name, animationFactory);

NOTE: animations take effect only if the ngAnimate module is loaded.

Defines an animation hook that can be later used with $animate service and directives that use this service.

module.animation('.animation-name', function($inject1, $inject2) {
  return {
    eventName : function(element, done) {
      //code to run the animation
      //once complete, then run done()
      return function cancellationFunction(element) {
        //code to cancel the animation
      }
    }
  }
})

See $animateProvider.register() and ngAnimate module for more information.

Parameters

Param Type Details
name string

animation name

animationFactory Function

Factory function for creating new instance of an animation.

doc_AngularJS
2016-03-29 16:10:57
Comments
Leave a Comment

Please login to continue.