Angular JS filter Search
<blockquote>
  <p>I want to retain the selected check boxes as is even when I am
  changing my search query. Initially I am posting some query in search
  and selecting one of the resulted values, Now if I change my search
  query, then New values will be my result. But I want to retain the
  checkbox selected for the previous values...</p>
</blockquote>

<p>`</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>//Demo of Searching and Sorting Table with AngularJS
var myApp = angular.module('myApp',[]);
  
 myApp.controller('TableCtrl', ['$scope', function($scope) {  
    
    $scope.allItems = getDummyData(); 
      
     $scope.resetAll = function()
     {
         $scope.filteredList = $scope.allItems ; 
         $scope.newEmpId = '';
         $scope.newName = '';
         $scope.newEmail = '';
         $scope.searchText = ''; 
     }
     
     
     $scope.add = function()
     {
         $scope.allItems.push({EmpId : $scope.newEmpId, name : $scope.newName, Email:$scope.newEmail});
         $scope.resetAll();  
     }
     
     
    $scope.search = function()
    { 
        $scope.filteredList  = _.filter($scope.allItems,
                 function(item){  
                     return searchUtil(item,$scope.searchText); 
                 });
        
        if($scope.searchText == '')
        {
            $scope.filteredList = $scope.allItems ;
        }
    }  
    
    $scope.resetAll();       
}]);
 
/* Search Text in all 3 fields */
function searchUtil(item,toSearch)
{
    /* Search Text in all 3 fields */
    return ( item.name.toLowerCase().indexOf(toSearch.toLowerCase()) &gt; -1 || item.Email.toLowerCase().indexOf(toSearch.toLowerCase()) &gt; -1 || item.EmpId == toSearch
                            )                              
                     ? true : false ;
}

/*Get Dummy Data for Example*/
function getDummyData()
{
    return [
         {EmpId:2, name:'Jitendra', Email: 'jz@gmail.com'},
         {EmpId:1, name:'Minal', Email: 'amz@gmail.com'},
         {EmpId:3, name:'Rudra', Email: 'ruz@gmail.com'} 
        ];
}</code></pre>
<pre class="snippet-code-css lang-css prettyprint-override"><code>.icon-search{margin-left:-25px;}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;br /&gt; &lt;br /&gt;

&lt;div ng-app="myApp"&gt; 
    &lt;div ng-controller="TableCtrl"&gt; 
        
        &lt;div class="input-group"&gt;
  &lt;input class="form-control"   ng-model="searchText" placeholder="Search" type="search" ng-change="search()" /&gt;
  &lt;span class="input-group-addon"&gt;
      &lt;span class="glyphicon glyphicon-search"&gt;&lt;/span&gt;
  &lt;/span&gt;
&lt;/div&gt;
             
        &lt;table class="table  table-hover data-table sort display"&gt;
             &lt;thead&gt;
                 &lt;tr&gt;
                     &lt;th class="EmpId"&gt; &lt;a href="" ng-click="columnToOrder='EmpId';reverse=!reverse"&gt;EmpId 
                          
                         &lt;/a&gt;&lt;/th&gt;
                     &lt;th class="name"&gt; &lt;a href="" ng-click="columnToOrder='name';reverse=!reverse"&gt; Name &lt;/a&gt; &lt;/th&gt;
                 &lt;th class="Email"&gt; &lt;a href="" ng-click="columnToOrder='Email';reverse=!reverse"&gt; Email &lt;/a&gt; &lt;/th&gt;
                     
                 &lt;/tr&gt;
             &lt;/thead&gt; 
             &lt;tbody&gt;
                 
                 &lt;tr ng-repeat="item in filteredList | orderBy:columnToOrder:reverse"&gt;
                     &lt;td&gt;&lt;input type="checkbox" name="test" /&gt;{{item.EmpId}}&lt;/td&gt;
                     &lt;td&gt;{{item.name}}&lt;/td&gt;
                     &lt;td&gt;{{item.Email}}&lt;/td&gt;
                 &lt;/tr&gt;
             &lt;/tbody&gt;
        &lt;/table&gt;
         
        
&lt;div class="row"&gt;
  &lt;div class="col-xs-3"&gt;
    &lt;input type="text" ng-model="newEmpId" class="form-control" placeholder="EmpId"&gt;
  &lt;/div&gt;
  &lt;div class="col-xs-3"&gt;
    &lt;input type="text" ng-model="newName" class="form-control" placeholder="Name"&gt;
  &lt;/div&gt;
  &lt;div class="col-xs-4"&gt;
    &lt;input type="email" ng-model="newEmail" class="form-control" placeholder="Email"&gt;
  &lt;/div&gt; 
     &lt;div class="col-xs-1"&gt;
         &lt;button ng-click="add()" type="button" class="btn btn-primary"&gt;
              &lt;span class="glyphicon glyphicon-plus"&gt;&lt;/span&gt;
        &lt;/button&gt; 
      &lt;/div&gt; 
&lt;/div&gt;

        
        
    &lt;/div&gt; &lt;!-- Ends Controller --&gt;
 
    &lt;/div&gt;</code></pre>
</div>
</div>
</p>

<p>`<a href="http://jsfiddle.net/3a3zD/193/" rel="nofollow noreferrer">Fiddle</a></p>