title: Angular: How to perform search on button click
body: <p>this is a sample code where user write some data in textbox and result filter accordingly but how can i filter data by clicking button?</p>
  
  <pre><code>&lt;div ng-app="myApp" ng-controller="MyController"&gt;
   &lt;label&gt;Field: 
     &lt;select ng-model="selectedFieldName"&gt;
        &lt;option value=""&gt;--Select Account--&lt;/option&gt;
            &lt;option ng-repeat="(fieldname,fieldvalue) in customer[0]" ng-value="fieldname | uppercase"&gt;{{fieldname | uppercase}}&lt;/option&gt;
     &lt;/select&gt;  
  &lt;/label&gt;
  
  &lt;label&gt;data: &lt;input ng-model="searchText"&gt;&lt;/label&gt;
      &lt;table class="table table-striped table-bordered"&gt;
          &lt;tr&gt;
            &lt;td&gt;ID&lt;/td&gt;
            &lt;td&gt;First Name&lt;/td&gt;
            &lt;td&gt;Last Name&lt;/td&gt;
            &lt;td&gt;Salary&lt;/td&gt;
            &lt;td&gt;Date of Birth&lt;/td&gt;
            &lt;td&gt;City&lt;/td&gt;
            &lt;td&gt;Phone&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr ng-repeat="item in customer | filter:SearchList "&gt;
          &lt;!-- orderBy:'$index':false --&gt;
              &lt;td&gt;{{ item.id }}&lt;/td&gt;
              &lt;td&gt;{{ item.firstname }}&lt;/td&gt;
              &lt;td&gt;{{ item.lastname }}&lt;/td&gt;
              &lt;td&gt;{{ item.salary }}&lt;/td&gt;
              &lt;td&gt;{{ item.dob }}&lt;/td&gt;
              &lt;td&gt;{{ item.city }}&lt;/td&gt;
              &lt;td&gt;{{ item.phone }}&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/div&gt;
  
  ;var myApp = angular.module('myApp', []);
  
  myApp.controller('MyController', function MyController($scope) {
  
      $scope.selectedFieldName='';
      $scope.searchText='';
  
          $scope.SearchList = function(row) {
  
      if ($scope.selectedFieldName &amp;&amp; $scope.searchText) {
        var propVal = row[$scope.selectedFieldName.toLowerCase()]+ '';
        if (propVal) {
          return propVal.toUpperCase().indexOf($scope.searchText.toUpperCase()) &gt; -1;
        } else {
          return false;
        }
      }
      return true;    
    };
  
      $scope.customer = [
        {
            'id': 1,
            'firstname': 'Tridip',
            'lastname': 'Bhattacharjee',
            'salary' : 15000,
            'dob': '05/09/2013',
            'city': 'kolkata',
            'phone': '033 2589 7415'
        },
        {
            'id': 2,
            'firstname': 'Arijit',
            'lastname': 'Banerjee',
            'salary' : 25000,
            'dob': '01/09/2010',
            'city': 'Bihar',
            'phone': '033 2589 9999'
        },
        {
            'id': 3,
            'firstname': 'Dibyendu',
            'lastname': 'Saha',
            'salary' : 20000,
            'dob': '06/09/2011',
            'city': 'Rachi',
            'phone': '033 2589 3333'
        },
        {
            'id': 4,
            'firstname': 'Bisu',
            'lastname': 'Das',
            'salary' : 5000,
            'dob': '05/01/2009',
            'city': 'Silchar',
            'phone': '033 2589 2222'
        },
        {
            'id': 5,
            'firstname': 'Soumyajit',
            'lastname': 'Kar',
            'salary' : 12000,
            'dob': '09/08/2011',
            'city': 'kanpur',
            'phone': '033 3333 1894'
        }
      ];
  })
  </code></pre>
  
  <p>please see my code and tell if i add one button then how could i trigger custom filter when user click on button after write data in textbox for search. looking for guide line. thanks</p>