Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

ng-class-even/odd is broken in 1.0.3 #1638

Closed
orneryd opened this issue Dec 3, 2012 · 4 comments
Closed

ng-class-even/odd is broken in 1.0.3 #1638

orneryd opened this issue Dec 3, 2012 · 4 comments

Comments

@orneryd
Copy link

orneryd commented Dec 3, 2012

even/odd classes randomly not getting applied properly in 1.0.3 when used in an ng-repeat

1.0.2
http://plnkr.co/edit/hXTbxR?p=preview

1.0.3
http://plnkr.co/edit/DdJQCH?p=preview

scroll through on each one and you will see what I mean.

@jtymes
Copy link
Contributor

jtymes commented Dec 3, 2012

I'm going to say that this is related to #1637 because even/odd depend on the base function.

@ChrisHuston
Copy link

It seems that removeClass and addClass are being passed undefined which is causing problems. As a quick hack, checking for undefined apparently fixes the issue:

function removeClass(classVal) {
    if (classVal === undefined) {
        return;
    }
  if (isObject(classVal) && !isArray(classVal)) {
    classVal = map(classVal, function(v, k) { if (v) return k });
  }
  element.removeClass(isArray(classVal) ? classVal.join(' ') : classVal);
}


function addClass(classVal) {
    if (classVal === undefined) {
        return;
    }
  if (isObject(classVal) && !isArray(classVal)) {
    classVal = map(classVal, function(v, k) { if (v) return k });
  }
  if (classVal) {
    element.addClass(isArray(classVal) ? classVal.join(' ') : classVal);
  }
}

@pkozlowski-opensource
Copy link
Member

@timothyswt Tim, both plunkers seem to be broken so I can't re-test but the #1637 was closed and it should fix your issue as well. Could you test with the version from http://code.angularjs.org/snapshot/angular.js to confirm?

Thnx!

@pkozlowski-opensource
Copy link
Member

@timothyswt Haven't heard from you, but as I've said, it should be fixed in 1.0.5. Closing for now, please re-open if you can still see the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants