title: AngularJS Timeout and requests
body: <p>In AngularJS i do the get requests using the following code</p>
  
  <pre><code>myApp.service('ApiCall', function($http, $q){
  
      this.get_req = function() {
  
                              var deferred = $q.defer();
                              $http({
                                  method: 'GET',
                                  url: 'API/RESOURCE',
                                  data :params,
                                  cache :false
                              }).then(function success(response) {
                                  deferred.resolve(response.data);
                                }, function error(error) {
                                  deferred.reject(error);
                                });
                              return deferred.promise;
                          };
  
  });
  </code></pre>
  
  <p>This works perfectly but i need to enhance it and have more control over it.</p>
  
  <p>What i want to do is the following</p>
  
  <ol>
  <li>once the request fails and set a timer to retry in 5 seconds</li>
  <li>Then if it fails retry in 10 </li>
  <li>Then 15</li>
  <li>Then if after those 30 seconds pop up an alert saying what ever i want.</li>
  </ol>
  
  <p>How do i achieve this.</p>