我有一个json对象.它不按升序排序.
$scope.myData = { "MAX" : "some value","Forms" : "some value","Grids And Tables" : "some value","Navigation" : "some value","Services & APIs" : "some value" }
我使用ng-repeat在我的html模板中显示它.我得到了结果,但订单已按升序改变.
Forms Grids And Tables MAX Navigation Services & APIs
如何防止角度js自动排序?
检查这个link
如建议的那样,无法对对象键进行排序.购买你可以对使用这些对象键创建的数组进行排序 –
原文链接:https://www.f2er.com/angularjs/141487.html$scope.keys = Object.keys($scope.myData); <ul> <li ng-repeat="key in keys"> {{key}} - {{myData[key]}} </li> </ul>