ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
### 8.1. 排序 orderBy _orderBy_ 是一个排序用的过滤器标签。它可以像 _sort_ 函数那样支持一个排序函数,也可以简单地指定一个属性名进行操作: <div ng-controller="TestCtrl"> {{ data | orderBy: 'age' }} <br /> {{ data | orderBy: '-age' }} <br /> {{ data | orderBy: '-age' | limitTo: 2 }} <br /> {{ data | orderBy: ['-age', 'name'] }} <br /> </div> <script type="text/javascript"> var TestCtrl = function($scope){ $scope.data = [ {name: 'B', age: 4}, {name: 'A', age: 1}, {name: 'D', age: 3}, {name: 'C', age: 3}, ]; } angular.bootstrap(document.documentElement); </script>