0

The orderBy child of element option in angularJS is not working. I want to order by "pos" child. Thanks

$scope.commands = {
"xyz" : {
"group":"g2",
"pos":2
},
"abc" : {
"group":"g2",
"pos":3
},
"ijk" : {
"group":"g1",
"pos":1
}
};

<div ng-repeat="(key, data) in commands | orderBy:'data.pos'">{{data.pos}} - {{key}}</div>
3psilon
  • 135
  • 3
  • 11

1 Answers1

1

filters in ng-repeat will only work on arrays and not on objects, you have write custom filter and sort it.

I will try to create one and share.

madhured
  • 443
  • 2
  • 8
  • Check this out for more information: http://justinklemm.com/angularjs-filter-ordering-objects-ngrepeat/ – koolunix Mar 04 '14 at 17:19