title: Filtering in AngularJS ngtable not working
body: <p>I'm new to AngularJS so I'm not completely familiar with how everything works, but I have an ngtable setup that I'm trying to filter based on an input search textbox above the table. The 'searchtext' is being passed in via a queryParam string. However, I'm unable to understand why it's not filtering. The sorting of all the data in the table is working fine. I'd appreciate any feedback you could offer. I think the issue lies in my service. Should I be accepting the queryParam string in it? </p>
  
  <p>Thank you!</p>
  
  <h1>Update</h1>
  
  <p>Any additional info I can provide for assistance? </p>
  
  <p>The data coming back is in an array. Instead of passing queryParams back to the database to filter the data I'd like to just filter the data in the ngtable. All the data is already contained in $scope.data</p>
  
  <h1>HTML</h1>
  
  <pre><code>        &lt;div class="row" style="margin: 20px 0px 20px 0px"&gt;
            &lt;div class="col-md-6"&gt;
              &lt;form class="form-inline" style="white-space:nowrap;"&gt;
                &lt;div class="form-group has-feedback"&gt;
                  &lt;label class="sr-only" for="videoSearch" translate="SEARCH_TXT"&gt;&lt;/label&gt;
                  &lt;input type="search" ng-model="learnVideos.searchtext" class="form-control" id="videoSearch" translate translate-attr-placeholder="SEARCH_TXT" ng-change="videoTableParams.reload()"&gt;
                  &lt;i class="fa fa-search form-control-feedback"&gt;&lt;/i&gt;
                &lt;/div&gt;
              &lt;/form&gt;
            &lt;/div&gt;
  </code></pre>
  
  <h1>NGTABLE</h1>
  
  <pre><code>    $scope.learnVideos = {
          searchtext: ''
        };
      // Table view for listing videos
        $scope.totalVideosDisplaying = 0;
        $scope.totalVideosRecCount = 0;
        $scope.videoTableParams = new NgTableParams({
          page: 1,
          count: 10,
          sorting: { videoName : "asc" }
        }, {
            total: $scope.totalVideosRecCount,
            getData: function (params) {
            $scope.actionInProgress.get = true;
  
            var sortString = '';
            angular.forEach(params.sorting(), function (value, key) {
              var column = key.replace('$', '.');
              if (sortString == '')
                sortString += column + '=' + value;
              else
                sortString += '&amp;' + column + '=' + value;
            });
            var queryParam = 'Page=' + params.page() +
              '&amp;Count=' + params.count() + '&amp;sort=' + encodeURIComponent(sortString) + '&amp;searchtext=' + 
      $scope.learnVideos.searchtext;
  
            return learnVideoService.getVideos(queryParam).then(function (data) {
              // Success Callback
              $scope.actionInProgress.get = false;
              $scope.totalVideosRecCount = data.totalRecCount;
              params.total($scope.totalVideosRecCount);
              $scope.data = data.videoLearningList;
              $scope.data = params.sorting() ? $filter('orderBy')($scope.data, params.orderBy()) : 
       $scope.data;
              $scope.data = params.filter() ? $filter('filter')($scope.data, params.filter()) : 
       $scope.data;
  
              $scope.data = $scope.data.slice((params.page() - 1) * params.count(), params.page() * 
      params.count());
              $scope.pagedVideos = $scope.data;
              $scope.totalVideosDisplaying = $scope.pagedVideos.length;
              return $scope.pagedVideos;
            }).catch(function (error) {
              // Error Callback
              $scope.actionInProgress = false;
            });
          }
        });
  </code></pre>
  
  <h1>Service</h1>
  
  <pre><code>define(['app', 'URI', 'staticData'], function (app, URI, staticData) {
    app.service('learnVideoService', ['$http', '$q', function ($http, $q) {
      var service = {};
      // Get Videos
      function getVideos() {
        var url = new URI(staticData.apiPaths.learning.learningItems);
        var deferred = $q.defer();
        $http.get(url.toString()).success(function (data) {
          deferred.resolve(data);
        }).error(function (errorcode, errormessage) {
          $q.reject(errorcode, errormessage);
        });
        return deferred.promise;
      }
  
      service = {
        getVideos: getVideos
      };
  
      return service;
  
    }]);
  });
  </code></pre>