最佳答案
如何在angular中同时使用多个字段进行排序?首先按组,然后按子组 例如< / p >
$scope.divisions = [{'group':1,'sub':1}, {'group':2,'sub':10}, {'group':1,'sub':2},{'group':1,'sub':20},{'group':2,'sub':1},
{'group':2,'sub':11}];
我想把它显示为
1 - 1
1 - 2
1 - 20
2 - 1
2 - 10
2 - 11
<select ng-model="divs" ng-options="(d.group+' - '+d.sub) for d in divisions | orderBy:'group' | orderBy:'sub'" />