1

I have an object upon which I'm using the ng-repeat directive. I would like to order the repeat directive based on the length of the array, which is inside the iterated object. If the directive is used on an array of arrays, everything works as expected. But I'm using the directive on object containing arrays, and orderBy:'length' isn't working.

Please see these two fiddles for reference:

Working on array of arrays

Not working on object of arrays

Thanks.

Teo.sk
  • 2,619
  • 5
  • 25
  • 30

1 Answers1

1

the problem is, object don't have ".length" you have to count it with a function, look at it stackoverflow similar issue

Community
  • 1
  • 1
ThomasP1988
  • 4,597
  • 3
  • 30
  • 36
  • 1
    right, I actually solved this problem before but I forgot (I upvoted few solutions in the answer you linked some time ago). Thanks! – Teo.sk Jul 18 '14 at 11:54