我有一个ng-repeat,我正在试着得到一个特定的订单。我看到我可以使用属性列表进行排序:
ng-repeat="client in clients | orderBy: ['isOpen', 'lastAccessTime']"我的问题是,如何配置升序和降序?
我想在isOpen上使用DESC进行主要排序,在lastAccessTime上使用ASC进行辅助排序。如何在我的ng-repeat中实现这一点
编辑:我在下面试过了,但是当两个项目都是isOpen时,最高的lastAccessTime不在顶部:
ng-repeat="client in clients | orderBy: 'isOpen':true | orderBy: 'lastAccessTime'"发布于 2014-01-31 13:37:34
可以使用+或-作为属性名称的前缀,以指示升序或降序,如指定的in the documentation for orderBy所示。
发布于 2014-01-31 13:44:38
可以使用数组和前缀+或-来控制升序或降序排序顺序
ng-repeat="client in clients | orderBy: ['isOpen','-lastAccessTime']"
https://stackoverflow.com/questions/21473069
复制相似问题