我想要做的是按属性排序一些数据。这是我应该努力的例子,但事实并非如此。
HTML部分:
<div ng-app='myApp'>
<div ng-controller="controller">
<ul>
<li ng-repeat="(key, value) in testData | orderBy:'value.order'">
{{value.order}}. {{key}} -> {{value.name}}
</li>
</ul>
</div>
</div>
JS部分:
var myApp = angular.module('myApp', []);
myApp.controller('controller', ['$scope', function ($scope) {
$scope.testData = {
C: {name:"CData", order: 1},
B: {name:"BData", order: 2},
A: {name:"AData", order: 3},
}
}]);
结果如下:
A - > AData
B - > BData
C - > CData
......恕我直言应该是这样的:
C - > CData
B - > BData
A - > AData
我错过了什么(这里准备JSFiddle进行实验)?
倚天杖
幕布斯6054654
相关分类