/** * Invoke a CSS animation on `this` angular.element instance. * @param className classname of animation to invoke on `this` element * @param delay delay before animation is invoked * @param done callback */ angular.element.prototype.doAnim = function(className, delay, done, doneDelay) { done = (typeof delay === 'function') ? delay : done; $timeout(function() { this.removeClass(className); $timeout(function() { this.addClass(className); $timeout(done, doneDelay || 0); }.bind(this), 100); }.bind(this), delay || 0); };