I know in my current version of Angular, ng-repeat
auto sorts. My problem is that its sorting doesn't appear to be correct.
Taking an object with numbered keys:
{
"1": "value",
"2": "value",
"10": "value"
}
ng-repeat
sorts it 1
, 10
, 2
. I'm familiar with this sort of sorting and throwing a 0 on the front of number should fix it. However adding that 0 requires additional code and would need to be stripped out for display.
Likewise, converting to an array caused ng-repeat
to loop through all of the empty values (3-9) and creates excess elements, as well as generating a duplicate error.
How can I make ng-repeat
sort an object by keys as if they were integers?