我试图显示一个包含大量元素的表。我想对表进行分页并仅加载当前页面上显示的元素。现在,json已经加载了 $resource
。
我读 这里 在json标头内传递分页信息(currentPage,pagesCount和elementsCount)是个好主意。
如何从角度访问json头中的那些信息?
这是基本的js结构:
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' });
}]);