title: Angular - abort ajax request when using Restangular
body: <p>I have a method that calls an angular service and consequently makes an ajax request via the service. I need to make sure that if this is called several times, the previous request in aborted (if it hasn't already been resolved that is). </p>
  
  <p>This method can get called multiple times. This method is actually from ngTable on <code>ngTableParams</code>:</p>
  
  <pre><code>getData = function($defer, params) {
  
        myService.getRecord(params).then(function(res){ 
               ...
               $defer.resolve(res.Records);
        }); 
  }
  </code></pre>
  
  <p>Here's the method on the service:</p>
  
  <pre><code>this.getRecords = function(params) {
      ...
  
      return Restangular
            .all('/api/records')
            .post(filters);
  };
  </code></pre>
  
  <p>If ngTable makes 3 calls I want the first 2 to be aborted (unless of course they returned so fast that it got resolved)</p>