使用filterFilter过滤数据

时间:2016-06-08 10:18:35

标签: angularjs sharepoint filter

我想使用filterFilter过滤重新获得的sharepoint列表。但是它给出了***错误:** angular.min.js:89 TypeError:filterFilter不是函数***** 由于使用$ https,无法向控制器注入过滤器。 以下是代码,

 $scope.update=function() 
    {

    $scope.drop=$scope.states.Id;
     console.log($scope.drop);
 $http({

    url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/Lists/getByTitle('List')/items?$select=State/Title,Title,Id&$expand=State/Title",  
    method: "GET",
    headers: { "Accept": "application/json; odata=verbose" }
    })
    .success(function (data, status, headers, config) {  

       $scope.city= filterFilter(data.d.results,{State:$scope.drop});
       console.log($scope.city);

    })
   .error (function(data, status, headers, config) {  })

}

1 个答案:

答案 0 :(得分:0)

感谢您的回复,我得到了答案,完整的代码在下面

local[*]

{

app.controller('Ctrl', function($filter,$scope,$http,filterFilter) 

$ scope.update =()的函数         {

 $http({

    url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/Lists/getByTitle('States')/items",  
    method: "GET",
    headers: { "Accept": "application/json; odata=verbose" }
    })
    .success(function (data, status, headers, config) {  
       $scope.State=data.d.results;
       console.log($scope.State);

    })
   .error (function(data, status, headers, config) {  })

}

});

如果您在$ select中使用*,则可以使用您可以比较的查找字段ID进行检索:)

相关问题