时间:2021-03-05 12:40:28 | 栏目:AngularJS | 点击:次
如下所示:
<div ng-app="module" ng-controller="ctrl"> <!--按照click降序排序--> {{data|orderBy:'click':true}}<br> <!--按照id升序排序--> {{data|orderBy:'id':false}}<br> <!--筛选匹配3的数据--> {{data|filter:'3'}}<br> <!--筛选完全匹配‘百度'--> {{data|filter:'百度':true}}<br> </div> <script> var m = angular.module('module', []); m.controller('ctrl', ['$scope', function ($scope) { $scope.data=[ {id:1,click:100,title:'百度'}, {id:2,click:350,title:'谷歌'}, {id:3,click:300,title:'网易'}, ]; }]); </script>
效果图: