title: Angular : intercept specific request with $resource
body: <p>I'm new to Angular, and am working on an interceptor. I created an angular factory to get some data from an API like that :</p>
  
  <pre><code>app.factory('Connection',['$resource',function($resource) {
  
      return $resource('url',{param1: '1',param2: '55'},);
  }]);
  </code></pre>
  
  <p>I also created the interceptor which looks like that :</p>
  
  <pre><code>app.factory('connectionInterceptor', function($q,$location) {
  
      var connectionInterceptor =  {
  
          response: // code here
          responseError: // code here
      };
      return connectionInterceptor;
  });
  </code></pre>
  
  <p>The interceptor works well. But it intercepts every http request I do, and I'd like to make it work for a specific $resource. I read in angular $resource doc that there is a way to make it by adding an interceptor action/param to $resource. So I tried :</p>
  
  <pre><code>app.factory('Connection',['$resource',function($resource) {
  
      return $resource('http://localhost:8080/api/login',{user: '1',password: '55'}, {}, 
          query: {
              method : 'GET',
              interceptor : 'connectionInterceptor'
          }
      });
  }]);
  </code></pre>
  
  <p>which didn't work. The thrown error is : <code>Error in resource configuration for action query. Expected response to contain an object but got an array</code>.</p>
  
  <p>What did I miss ? </p>