title: Angular $resource receives error although server returns correctly
body: <p>I'm trying to retrieve JSON data from a MongoDB server through Express, Mongoose and Angular <code>$resource</code>. Although the server obviously returns the correct data, the error function is always called and a strange error is shown.</p>
  
  <p>This is (sort of) the controller:</p>
  
  <pre><code>.controller('DefaultContentController',
      ['$scope',
      '$location',
      'pageFactory',
      function($scope, $location, pageFactory) {
          var path = $location.path().split('/');
  
          pageFactory.getPages().get({slug:path[1]})
              .$promise.then(
                 function(response) {
                     console.log(response);
                 },
                 function(response) {
                     console.log("Error: " +  response.status);
                     console.log("Status text: " + response.statusText);
                 }
              );
          }])
  </code></pre>
  
  <p><code>pageFactory.getPages</code> is defined as</p>
  
  <pre><code>        this.getPages = function(){
              return $resource("http://localhost:3000/pages/:slug", {});
          };
  </code></pre>
  
  <p>Executing this with a location that evaluates to a slug of <code>packages</code> results in the following:</p>
  
  <ul>
  <li>No JavaScript error or anything else in the console of the browser</li>
  <li>my custom error output in the console:<br>
  <code>Error: -1</code><br>
  <code>Status text:</code></li>
  <li>The server reports <code>GET /pages/packages 200 2.683 ms - 303</code> in its log output</li>
  </ul>
  
  <p>If I enter the location in a browser the correct JSON response is displayed, so obviously the server itself is working properly. The raw response (as logged by Firefox HttpRequrester extension) is</p>
  
  <pre><code>GET http://localhost:3000/pages/packages
  
   -- response --
  200 OK
  X-Powered-By:  Express
  Content-Type:  application/json; charset=utf-8
  Content-Length:  305
  Etag:  W/"131-BTgYonvS22Ju7nZNcmxv0w"
  Date:  Thu, 24 Mar 2016 12:44:43 GMT
  
  [{"_id":"56f3c58ebbea0d5a0e39630a","updatedAt":"2016-03-24T10:46:38.463Z","createdAt":"2016-03-24T10:46:38.463Z","slug":"packages","title":"Packages","html":"&lt;p&gt;As long as there is no auto-generated package documentation this page will simply contain a list of available packages.&lt;/p&gt;","__v":0,"tabs":[]}]
  </code></pre>
  
  <p>Is there any idea where I can investigate further?</p>