【发布时间】:2017-06-23 23:01:15
【问题描述】:
以下代码用于 HTML 中的分页:
<button ng-disabled="" ng-click="previousPage(limit,offset)">
Previous
</button>
<button ng-disabled="" ng-click="nextPage(limit,offset)">
Next
</button>
在控制器文件中:
$scope.previousPage=function(limit,offset){
adminservice.getPagination().then(function(response){
adminservice.showAllVehicleDetails().then(function(){
$scope.vehicledetails=response.data[0][limit-10][offset+10];
console.log('limitNumber',limit)
console.log('offsetNumber',offset)
});
});
}
$scope.nextPage=function(limit,offset){
adminservice.getPagination().then(function(response){
adminservice.showAllVehicleDetails().then(function(){
$scope.vehicledetails=response.data[0][limit+10][offset-10];
});
});
}
在服务文件中:
var getPagination=function(){
return $http({
url:apiurl+'paginatedetails',
method:"GET",
params:{limitNumber:limit,offsetNumber:offset}
});
}
谁能告诉我正确的方法?当我运行此代码时,控制台显示如下错误:limit is not defined at Object.getPagination。
【问题讨论】:
标签: javascript angularjs pagination