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

2015-10-22  本文已影响15人  sallon

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参数进行排序

上一篇下一篇

猜你喜欢

热点阅读