I am trying to display a table with a large collection of elements. I want to paginate the table and load only the elements displayed on the current page. Now, the json is loaded with $resource
.
I read here that it's a good idea to pass the pagination infos (currentPage, pagesCount and elementsCount) inside the json header.
How can I access to those infos which are in the json header from angular?
Here is the basic js structure:
angular.module('App.services', ['ngResource']).
factory('List', function($resource){
return $resource('url/of/json/:type/:id', {type:'@type', id:'@id'});
});
angular.module('App.controllers', []).
controller('ListCtrl', ['$scope', 'List', function($scope, List) {
var $scope.list= List.query({offset: 0, limit: 100, sortType: 'DESC' });
}]);