过滤器无法在Angular JS ng-grid中运行

时间:2014-10-21 08:57:42

标签: angularjs

我正在努力在angular js点击按钮时实施过滤。

我有一个输入搜索文本框,搜索按钮和一个网格,如下所示

  <div ng-controller="NewsController">        
        Search
        <input type="text" 
               ng-model="searchtext">
        <button class="fa fa-search" 
                type="submit" 
                ng-click="searchNewsOrGuidelines();">
        </button> 
       <zoom-ui-grid options="NewsGridOptions" 
                     class="gridStyle">
       </zoom-ui-grid>   
  </div>

过滤器实现如下,不起作用

App.controller("NewsController", '$scope') {     
     $scope.searchNewsOrGuidelines = function () {
          $scope.filterOptions.filterText = $scope.searchtext;
          $scope.NewsGridConfiguration;
     }   
     $scope.filterOptions = {
            filterText: ''
     };
     $scope.NewsGridConfiguration = {
            url: "someurl/Get",
            logoOptions: $scope.logoOptions,
            columnDefinitions: some def
            filterOptions: {            
                  filterOptions: $scope.filterOptions,
                  useExternalFilter: true
            },
            filter: $scope.searchtext
     };                   
     $scope.NewsGridOptions = {
            gridConfiguration: $scope.NewsGridConfiguration,
            filterOptions: {
                 filterOptions: $scope.filterOptions,
                useExternalFilter: true
            }
     };
}]);

有人可以指出我正在做的错误吗?

1 个答案:

答案 0 :(得分:0)

filterOptions: {
                 filterOptions: $scope.filterOptions,
                useExternalFilter: true
            }

尝试这个,而不是这个,它应该解决问题:

filterOptions: $scope.filterOptions