title: AngularJS: $watch with debounce
body: <p>I have the following html which represents a search field:</p>
  
  <pre><code>&lt;input ng-model-options="{ debounce: 500 }" type="text" ng-model="name"&gt;
  </code></pre>
  
  <p>And the following js:</p>
  
  <pre><code>$scope.$watch('name', function(newVal, oldVal) {
              if(newVal != oldVal) {
                  $scope.pageChanged($scope.sort, $scope.name, $scope.sortDirection);
              }
          });
  </code></pre>
  
  <p>Now, my pageChanged function makes a REST call to my server and returns a list of entites based on the sort and search information (the "name"). Say that my user wants to search for a "Tom". I would like to avoid my application making three rest calls (name="T", name="To", name="Tom").</p>
  
  <p>I tried doing this with debounce, but it seems that watch doesn't work with debounce so I was wondering what would be the best way to implement this with minimal code?</p>