Hi,
In case someone needs.
It took some testing to figure out the exact details:
Works with 1.2.16, in coffeescript and JS.

animations = @angular.module 'myAppAnimations', ['ngAnimate']

slideUpDown = ->

  beforeAddClass: (el, className, done) ->
    if className == 'ng-hide'
      el.slideUp done
      (cancel) ->
        el.stop() if cancel
    else
      done()

  removeClass: (el, className, done) ->
    if className == 'ng-hide'
      el.hide()
      el.slideDown done
      (cancel) ->
        el.stop() if cancel
    else
      done()

animations.animation '.targetDiv', slideUpDown


  animations = this.angular.module('myAppAnimations', ['ngAnimate']);

  slideUpDown = function() {
    return {
      beforeAddClass: function(el, className, done) {
        if (className === 'ng-hide') {
          el.slideUp(done);
          return function(cancel) {
            if (cancel) {
              return el.stop();
            }
          };
        } else {
          return done();
        }
      },
      removeClass: function(el, className, done) {
        if (className === 'ng-hide') {
          el.hide();
          el.slideDown(done);
          return function(cancel) {
            if (cancel) {
              return el.stop();
            }
          };
        } else {
          return done();
        }
      }
    };
  };

  animations.animation('.targetDiv', slideUpDown);

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to