AngularJS |如何使用多维对象进行排序?

AngularJS | how to orderBy with a multidimensional Object?

我想让我的 ng-repeatrank 排序,我该如何写表达式?

<div ng-app="myApp" ng-controller="orderCtrl">
<ul>
<li ng-repeat="(key, value) in cars | orderBy: cars[key].rank ">
{{cars[key].longName}}</li>
</ul>
</div>

<script>
var app = angular.module('myApp', []);
app.controller('orderCtrl', function($scope) {
$scope.cars = {                
                "BTC" : {
                    "longName"   :   "Bitcoin",
                    "rank"       :   1
                },
                "BCH" : {
                    "longName"   :   "Bitcoin Cash",
                    "rank"       :   3
                },
                "ETH" : {
                    "longName"   :   "Ethereum",
                    "rank"       :   2
                },
                "ETC" : {
                    "longName"   :   "Ethereum Classic",
                    "rank"       :   15
                },
                "IOTA" : {
                    "longName"   :   "IOTA",
                    "rank"       :   4
                },
                "XRP" : {
                    "longName"   :   "Ripple",
                    "rank"       :   6
                },
                "XVG" : {
                    "longName"   :   "Verge",
                    "rank"       :   5
                }
        }; 
});
</script>

Order by 只能应用于数组而不是对象。您必须将对象转换为数组或创建自己的过滤器:https://justinklemm.com/angularjs-filter-ordering-objects-ngrepeat/