ng-options按组名排序组

时间:2016-01-15 10:28:58

标签: angularjs

我有一个在我的代码中使用ng-options指令的选择:

ng-options="cls as cls.name group by cls.related for cls in classes track by cls.name | orderBy:'related' "

cls.related可能有价值:

  1. '相关'
  2. '不相关'
  3. 问题在于ng-options将不相关的组置于顶层,将相关组置于其下。我该如何更改订单?

1 个答案:

答案 0 :(得分:0)

试试这个:

ng-options="cls as cls.name group by cls.related for cls in classes track by cls.name | orderBy:'related':true "
//Doc:
{{ orderBy_expression | orderBy : expression : reverse}}