[Django]-Angular NgRessource with paginated results from django rest framework

3👍

This is what worked for me:

app.config(['$resourceProvider', function($resourceProvider) {
  $resourceProvider.defaults.stripTrailingSlashes = false;
}]);

services.factory('Project', ['$resource',
    function($resource) {
        return $resource('api/project/:id/', {}, {
            query: {
                method: 'GET',
                url: 'api/projects/',
                isArray: true,
                transformResponse: function(data, headers) {
                    return angular.fromJson(data).results;
                },
            },  
        });
    }
]);

Leave a comment