title: ng-table filtering of concatenated values from scope
body: <p>I created an application in AngularJs with ngTable, I'm using ngTable to display the user data and by requirements, I must use a single column in a table to filter by first and last name, which are separated in the <code>$scope</code> and I concatenate the result on the table cell. But I cannot filter by the concatenation. </p>
  
  <p>I've tried to create a custom filter as it's outlined on <a href="http://bazalt-cms.com/ng-table/example/11" rel="nofollow noreferrer">http://bazalt-cms.com/ng-table/example/11</a> to accomplish this task, unsuccessfully so far. </p>
  
  <p>I could modify the scope when the data is received, by looping through the array, but the result set is expected to be pretty large and I don't think that'd be the correct way to do it.</p>
  
  <p>Below is a simplified example. Is there an 'Angular Way' to filter by the concatenated string, using a model or a filter?.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var app = angular.module('app', ['ngTable']);
  
  app.controller('IndexCtrl', function ($scope, $filter, ngTableParams) {
       $scope.people = [{
          "id": 1,
              "firstName": "Chuck",
              "lastName": "Norris",
      }, {
          "id": 2,
              "firstName": "John",
              "lastName": "Lennon",
      }, {
          "id": 3,
              "firstName": "Bender",
              "lastName": "Rodriguez",
      }];
      $scope.peopleCopy = $scope.people;
      $scope.mytable = new ngTableParams({
          page: 1,            // show first page
          count: 10,          // count per page
          sorting: {
              name: 'desc'
          }
          
      }, {
          getData: function ($defer, params) {
             $scope.people = angular.copy($scope.peopleCopy);
             var filteredData = $filter('filter')($scope.people, params.filter());
               $scope.people = $filter('orderBy')(filteredData, params.orderBy());
               $defer.resolve($scope.people);
          }
      });
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.19/angular.min.js"&gt;&lt;/script&gt;
  &lt;script src="http://bazalt-cms.com/assets/ng-table/0.3.0/ng-table.js"&gt;&lt;/script&gt;
  &lt;body ng-app="app"&gt;
  &lt;div ng-controller="IndexCtrl"&gt;
      &lt;table border="1" ng-table="mytable" show-filter="true"&gt;
              &lt;tr ng-repeat="person in $data"&gt;
                  &lt;td sortable="id" data-title="'Id'"&gt;{{person.id}}&lt;/td&gt;
                
                  &lt;!--td I want to sort by firstName + lastName --&gt;
                  &lt;td sortable="firstName" filter="{ 'firstName': 'text' }" data-title="'Name'"&gt;{{person.firstName +' '+ person.lastName}}&lt;/td&gt;
              &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/div&gt;
  &lt;/body&gt;</code></pre>
  </div>
  </div>
  </p>