99re热这里只有精品视频,7777色鬼xxxx欧美色妇,国产成人精品一区二三区在线观看,内射爽无广熟女亚洲,精品人妻av一区二区三区

AngularJS 排序過濾器標(biāo)簽:orderBy

2018-07-26 17:28 更新

orderBy 是一個排序用的過濾器標(biāo)簽。它可以像 sort 函數(shù)那樣支持一個排序函數(shù),也可以簡單地指定一個屬性名進(jìn)行操作:

<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">
angular.module('app', [], angular.noop)
.controller('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, ['app']);
</script>
以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號