Angularjs分页

来自ling
跳转至: 导航搜索
		$scope.pageNumber=1;
		$scope.pageSize=10;
		$scope.busy=false;
		query=function(){
			if ($scope.busy) return;
			$scope.busy = true;
		    var params={pageSize:$scope.pageSize,pageNumber:$scope.pageNumber,query:{}}
		    var url=convertToUrlParam(params);
		    $http.get(path + 'user/getCat.ljson?'+url).
		    success(function (data, status, headers, config) {
		        if (data.status == 0 && data.data != null) {
		        	var items = data.data;
		        	if(items.length>0){
		        		for (var i = 0; i < items.length; i++) {
					    	$scope.usablecarts.push(items[i]);
					    }
					    $scope.busy = false;
					    $scope.pageNumber+=1;
		        	}else{
		        		$scope.busy = true;
		        	}				    
		        } else {
		        	processErroCode(data);
		        }
		    }).
		    error(function (data, status, headers, config) {

		    });
		}

		query();

		$scope.nextPage=function(){
			query();
		}