From cecdd01a0f940f02253e1ae923e3cc1e060a643b Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Thu, 17 Sep 2015 23:23:19 +0200 Subject: [PATCH 1/2] Be less strict about data.next check It seems it can be either undefined or null --- angular-django-rest-resource.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-django-rest-resource.js b/angular-django-rest-resource.js index d1d8f6b..17cdf75 100644 --- a/angular-django-rest-resource.js +++ b/angular-django-rest-resource.js @@ -358,7 +358,7 @@ angular.module('djangoRESTResources', ['ng']). var paginator = function recursivePaginator(data) { // If there is a next page, go ahead and request it before parsing our results. Less wasted time. - if (data.next !== null) { + if (data.next != null) { var next_config = copy(httpConfig); next_config.params = {}; next_config.url = data.next; From f9af2c8dac82730e2e545d9241454ffba8c607e9 Mon Sep 17 00:00:00 2001 From: Soren Hansen Date: Thu, 17 Sep 2015 23:25:12 +0200 Subject: [PATCH 2/2] Pass .data attribute into recursivePaginator --- angular-django-rest-resource.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-django-rest-resource.js b/angular-django-rest-resource.js index 17cdf75..cce36c9 100644 --- a/angular-django-rest-resource.js +++ b/angular-django-rest-resource.js @@ -362,7 +362,7 @@ angular.module('djangoRESTResources', ['ng']). var next_config = copy(httpConfig); next_config.params = {}; next_config.url = data.next; - $http(next_config).success(function(next_data) { recursivePaginator(next_data); }).error(error); + $http(next_config).then(function(next_data) { recursivePaginator(next_data.data); }).catch(error); } // Ok, now load this page's results: forEach(data.results, function(item) {