AngularJS

$filter 官方用例代码

HTML

<div ng-app="filterExample">
    <div ng-controller="MainCtrl">
         <h3>{{ originalText }}</h3>

         <h3>{{ filteredText }}</h3>

    </div>
</div>

JavaScript

angular.module('filterExample', [])
    .controller('MainCtrl', function ($scope, $filter) {
    $scope.originalText = 'hello';
    $scope.listA = [{id:1,text:"123"},{id:11,text:"345"}];
    $scope.filteredText = $filter('filter')($scope.listA,function(value){
    return value.id == 1;
    });
});