如何在Angular ng-repeat中按多个元素排序?

3
我知道如何进行简单的 orderBy,就像这样:
ng-repeat="test in tes.tests orderBy: 'modifiedDate'">

但如何按标题(升序)和最近编辑者(最新的在前)排序呢?

1
数组:[+'modifiedDate', '-another'] - Alon Eitan
尝试使用此链接:https://dev59.com/WGIj5IYBdhLWcg3waEf8 - Hadi J
@AlonEitan - 你能否再解释一下或者给出一个展示这个的答案?我是不是应该用你的答案替换'modifedBy'? - Alan2
2个回答

4

您应该使用:

ng-repeat="test in tes.tests | orderBy:['+title','-modifiedDate']

2
是的,你可以。
<div ng-repeat="test in tes.tests | orderBy: ['title','-modifiedDate']"> {{title}} - {{modifiedDate}}  </div>

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接