From 33d45d8fafb5abf99e6fd811cad1dd57daab918b Mon Sep 17 00:00:00 2001 From: Matias Niemelä Date: Mon, 29 Jul 2013 16:24:05 -0400 Subject: fix(ngClass): ensure ngClass doesn't fire addClass or removeClass with an empty string If ngClass fires off an add- or removeClass whilst the opposite animation is going on then the animation will be skipped. The default behavior of ngClass was executing remoteClass with an empty string while addClass had just fired. This commit fixes that bug. --- src/ng/directive/ngClass.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/ng/directive/ngClass.js') diff --git a/src/ng/directive/ngClass.js b/src/ng/directive/ngClass.js index a5b2acb6..0c4d23f0 100644 --- a/src/ng/directive/ngClass.js +++ b/src/ng/directive/ngClass.js @@ -42,12 +42,18 @@ function classDirective(name, selector) { function removeClass(classVal) { - $animate.removeClass(element, flattenClasses(classVal)); + classVal = flattenClasses(classVal); + if(classVal && classVal.length > 0) { + $animate.removeClass(element, classVal); + } } function addClass(classVal) { - $animate.addClass(element, flattenClasses(classVal)); + classVal = flattenClasses(classVal); + if(classVal && classVal.length > 0) { + $animate.addClass(element, classVal); + } } function flattenClasses(classVal) { -- cgit v1.2.3