0
我有以下的JSON:AngularJS +分頁+引導
http://localhost:3001/images?page=1
{"images":[{"_id":"542e57a709d2d60000c93953","name":"image1","url":"http://www.syll.com","__v":0},{"_id":"542e58e19d237e5b790f4db2","name":"image154","url":"www.rufyge.com"},{"_id":"542e58e19d237e5b790f4db3","name":"image45784","url":"http://www.test.com"},{"_id":"542eb5bbe26bca641c676ec9","name":"image1","url":"http://www.syll.com","__v":0},{"_id":"542eff1197896530323371b2","name":"image1","url":"http://www.syll.com","__v":0},{"_id":"542f0514b96a17781a5de9ef","name":"image1","url":"http://www.syll.com","__v":0},{"_id":"542f0b618101e35037651a7b","name":"image1","url":"http://www.syll.com","__v":0},{"_id":"543247b7d78ae2dc6a73c4eb","name":"image1","url":"http://www.syll.com","__v":0},{"_id":"543249050fcae2f082ca3e70","name":"imageOCR1","url_image":"http://meta-e.aib.uni-linz.ac.at/ocr/images/biographie_ocr.gif","__v":0},{"_id":"543249050fcae2f082ca3e71","name":"imageOCR2","url_image":"http://www.textcreationpartnership.org/files/2012/02/ocr.jpg","__v":0}],"pageCount":7,"itemCount":66}
有:
"pageCount":7,"itemCount":66
然後也:
http://localhost:3001/images?page=2
http://localhost:3001/images?page=3
http://localhost:3001/images?page=4
...
我要找用Boostrap做分頁(上一頁/下一頁)和AngularJS。
我做:
<div ng-repeat="product in filteredId = (products | filter:search)">
<h3><a style="cursor: pointer;" ng-click="products.chosen = product">{{product.name}}</a></h3>
</div>
與我的控制器:
function imageController($scope, $http){
$scope.showCompanies = function(){
$http.get('http://localhost:3000/images')
.success(function(response){
$scope.products = response;
console.log(response); })
.error(function(response){ alert('Une erreur est survenue'); console.log(response); });
}
$scope.showCompanies();
}
但是沒有分頁。
任何想法如何迭代所有的JSON並有一個Next/Prev按鈕來獲取?
感謝您的幫助!
你應該使用'smartTable' [執行功能看到文檔](http://lorenzofox3.github.io/smart-table-website/) – Saqueib 2015-01-30 09:15:02
你使用angular.js bootstrap? – 2015-08-12 10:28:18