After using lodash.js groupBy to organize my collection, the order is correct when I log it with console.debug. However, when I try to display it in the UI using ng-repeat, the ordering gets messed up.
var list = [{id:1,categoryId:1,name:test1},
{id:2,categoryId:2,name:test2},
{id:3,categoryId:12,name:test12}]
vm.myList= _.groupBy(list,function (j) { return j.categoryId; });
console.debug(vm.myList) // this shows the correct ordering!!!
Despite my efforts with orderBy in ng-repeat, the display order is incorrect:
<div ng-repeat="(categoryId, details) in vm.myList| orderBy: 'categoryId'>
{{ categoryId }}
</div>
The current output is:
1
12
2
I want it to display as:
1
2
12
I have tried sorting by parsing the categoryId but it doesn't work:
<div ng-repeat="(categoryId, details) in vm.myList| orderBy: 'parseInt(categoryId)'>
{{ categoryId }}
</div>
UPDATE! This issue does not occur in Angular 1.4.x. Unfortunately, we are using an older version, Angular 1.3.x.