aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng/animate.js
diff options
context:
space:
mode:
authorMatias Niemelä2014-02-14 04:02:46 -0500
committerIgor Minar2014-02-14 16:30:48 -0800
commit4f84f6b3e4210ae1eb14728a46d43dd961700a0c (patch)
tree7194406fbd76e553687200fb1a6a284ca8ca1e60 /src/ng/animate.js
parentcf5e463abd2c23f62e9c2e6361e6c53048c8910e (diff)
downloadangular.js-4f84f6b3e4210ae1eb14728a46d43dd961700a0c.tar.bz2
fix($animate): ensure $animate doesn't break natural CSS transitions
BREAKING CHANGE: ngClass and {{ class }} will now call the `setClass` animation callback instead of addClass / removeClass when both a addClass/removeClass operation is being executed on the element during the animation. Please include the setClass animation callback as well as addClass and removeClass within your JS animations to work with ngClass and {{ class }} directives. Closes #6019
Diffstat (limited to 'src/ng/animate.js')
-rw-r--r--src/ng/animate.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/ng/animate.js b/src/ng/animate.js
index fa5b936d..1961d47b 100644
--- a/src/ng/animate.js
+++ b/src/ng/animate.js
@@ -222,6 +222,29 @@ var $AnimateProvider = ['$provide', function($provide) {
done && $timeout(done, 0, false);
},
+ /**
+ *
+ * @ngdoc function
+ * @name ng.$animate#setClass
+ * @methodOf ng.$animate
+ * @function
+ * @description Adds and/or removes the given CSS classes to and from the element.
+ * Once complete, the done() callback will be fired (if provided).
+ * @param {jQuery/jqLite element} element the element which will it's CSS classes changed
+ * removed from it
+ * @param {string} add the CSS classes which will be added to the element
+ * @param {string} remove the CSS class which will be removed from the element
+ * @param {function=} done the callback function (if provided) that will be fired after the
+ * CSS classes have been set on the element
+ */
+ setClass : function(element, add, remove, done) {
+ forEach(element, function (element) {
+ jqLiteAddClass(element, add);
+ jqLiteRemoveClass(element, remove);
+ });
+ done && $timeout(done, 0, false);
+ },
+
enabled : noop
};
}];