Angularjs学习笔记(2)对一个组的对象进行排列

function PhoneListCtrl($scope){

        $scope.phones=[

         {"name":"Nexus S","snippet":"Fast just got faster with Nexus S.","age":0},                    {"name":"Motorola XOOM™ with Wi-Fi","snippet":"The Next, Next Generation tablet.","age":1},

           {"name":"MOTOROLA XOOM™","snippet":"The Next, Next Generation tablet.","age":2}

    ];

$scope.orderProp='age';

}

参数后面增加了一个参数:“age”

紧接着在controller中增加了一个:$scope.orderProp='age';

意思是根据age参数进行排序

你可能感兴趣的:(Angularjs学习笔记(2)对一个组的对象进行排列)