title: Angular.JS how to add a delay to Instant Search?
body: <p>My Html Form looks like</p>
  
  <pre><code>    &lt;form class="navbar-form navbar-left" role="search" name="userName"&gt;
        &lt;div class="form-group"&gt;
          &lt;input type="text" class="form-control" placeholder="Search Git By Username" ng-model="user" ng-change="searchForUser()" autofocus&gt;
        &lt;/div&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>My JavaScript code is</p>
  
  <pre><code> $scope.searchForUser = function() {
          $scope.selectedUser = null;
          $scope.selectedRepo = null;
          $scope.returnedRepos = [];
          $scope.returnedCommits = [];
          var url = "https://api.github.com/search/users?q=" + $scope.user;
          if($scope.user.length === 0){
              $scope.returnedUsers = null;
              return;
          }
  
          function updateUsers() {
  
              $http.get(url).
                  success(function(data,status) {
                      if(status===200) {
                          $scope.returnedUsers = data.items;
                      }
                  }).
                  error(function(data,status){
                      alert("something happened with quhhnnhhhh");
                  });
          }
  
          if($scope.userSearchTextTimeout)
          {
              $timeout.cancel($scope.userSearchTextTimeout);
          }
          $scope.userSearchTextTimeout = $timeout(function()
          {
              $scope.user = $scope.user;
          }, 500);
   };
  </code></pre>
  
  <p>I know I can use <strong>ng-model-options="{ debounce: 300 }"</strong> but I'm being asked to learn $timeout and how to cancel that event while the user is still typing. GitHub has a rate limit and if the user types too fast, GitHub returns a http 403 error</p>