我有一些数据:
0: {id: 1, name: "hhh", description: "hhh", isPopular: false,…}
1: {id: 2, name: "bbb", description: "bbb", isPopular: true,…}
2: {id: 3, name: "ccc", description: "ccc", isPopular: false,…}
3: {id: 4, name: "ddd", description: "ddd", isPopular: true,…}
4: {id: 5, name: "aaa", description: "aaa", isPopular: false,…}
5: {id: 6, name: "ggg", description: "ggg", isPopular: false,…}
我想在 ng-select 中显示为:
热门
bbb
ccc
其余
aaa
ccc
ggg
hhh
所以我用过
<select ng-selected="true"
ng-options="category.name group by category.isPopular for category in ctrl.categories |
orderBy: ['-isPopular','name']"
ng-model="myModel.category">
</select>
然而,这正在返回:
aaa
ccc
ggg
hhh
真实
bbb
ccc
我如何标记组并按组排序?