title: intercepting $resource and $http responses angular
body: <p>I have a json response:</p>
  
  <pre><code>{
    "success": false,
    "error": "Server says no.",
    "data": []
  }
  </code></pre>
  
  <p>wrapped in <code>$resource</code> like this:</p>
  
  <pre><code>$resource("path-to-file.json", null, {
    query: {
      method: "GET",
      isArray: false,
      responseType: "json",
      interceptor: {
        response: function (response) {
          if (!response.data.success) {
            // stop propagation of events/promises and trigger error
          }
          // do something else with response.data
          return response;
        }
      }
    }
  });
  </code></pre>
  
  <p>If <code>"success": false</code> I want to trigger the error function of <code>$http</code>.</p>
  
  <p>I want to do this:</p>
  
  <pre><code>$scope.myVar = MyService.query(); // MyService returns $resource
  </code></pre>
  
  <p>in a controller. The response gets passed to <code>$scope.myVar</code> regardless of what I try and do.</p>