多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
### 8.4. 例子:表头排序 1 <div ng-controller="TestCtrl"> 2 <table> 3 <tr> 4 <th ng-click="f='name'; rev=!rev">名字</th> 5 <th ng-click="f='age'; rev=!rev">年龄</th> 6 </tr> 7 8 <tr ng-repeat="o in data | orderBy: f : rev"> 9 <td>{{ o.name }}</td> 10 <td>{{ o.age }}</td> 11 </tr> 12 </table> 13 </div> 1415 <script type="text/javascript"> 16 var TestCtrl = function($scope){ 17 $scope.data = [ 18 {name: 'B', age: 4},19 {name: 'A', age: 1},20 {name: 'D', age: 3},21 {name: 'C', age: 3},22 ]; 23 } 2425 angular.bootstrap(document.documentElement); 26 </script>