title: Cancel a resource request in angular
body: <p>I am new to angular so I need detailed solution to this question. I have seen a lot of answers but not according to my situation.</p>
  
  <p>I have a service:</p>
  
  <pre><code>function ticketService($resource, globals) {
          return $resource(globals.API_URL+'/tickets/:id', {id: '@id'}, {
              update: {method: 'PUT'}
          });
      }
  </code></pre>
  
  <p>Now I need to cancel previous call when a new call is made. How I need to use <strong>timeout</strong> parameter here?</p>
  
  <p>In controller im calling this service like this:</p>
  
  <pre><code>ticketService.get({group_by: type}, function(data) {
  .
  .
  .
  .
  });
  </code></pre>
  
  <p>How I need to alter my service and controller.</p>
  
  <p>Thanks.</p>