title: django-rest pagination with angularjs
body: <p>I have an angularjs app working nicely with django-rest but have hit an issue by introducing pagination.  I have a restservice and controller as per the below</p>
  
  <pre><code>// restservices.js
  // API call for all images in an event
  services.factory('ImageEvent', function ($resource) {
      return $resource(rest_api + '/rest/image/?event_id=:eventId&amp;format=json', {}, {
          query: { method:'GET', params:{eventId:''}, isArray:true}
      })
  }); 
  
  // controllers.js
  // all Images in an event
  .controller('ImageEventCtrl', ['$scope', '$stateParams', 'ImageEvent', function($scope, $stateParams, ImageEvent) {
    $scope.images = ImageEvent.query({eventId: $stateParams.eventId}, function(images) {
    });
  }])
  </code></pre>
  
  <p>this returns the following json</p>
  
  <pre><code>[
      {
          "id": 13,
          "title": "01-IMG_4953.JPG",
      },
      {
          "id": 14,
          "title": "02-IMG_4975.JPG",
      },
      {
          "id": 15,
          "title": "03-IMG_4997.JPG",
      }
  ]
  </code></pre>
  
  <p>However if I turn on django-rest pagination it returns the following json:</p>
  
  <pre><code>{
  
      "count": 3,
      "next": "/rest/image/?event_id=1&amp;page=2",
      "previous": null,
      "results": 
      [
  
          {
              "id": 13,
              "title": "01-IMG_4953.JPG",
          },
          {
              "id": 14,
              "title": "02-IMG_4975.JPG",
          }
      ]
  
  }
  </code></pre>
  
  <p>This change has caused the following console error and everything fails to work:</p>
  
  <p>Error: [$resource:badcfg] Error in resource configuration. Expected response to contain an array but got an object</p>
  
  <p>Changing the restservice to isArray:false has made no difference.  Can my controller be re-written to cope with this and in a perfect world also expose the count, next and previous links?</p>
  
  <p>Thanks</p>