angularJs中orderBy篩選以及filter過濾資料
阿新 • • 發佈:2019-01-07
<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 >
效果圖: