1 2 3 4 5 6 7 8 9 10 11 12 | < table class = "table table-striped" > < thead > < tr > < th ng-repeat = "column in queryResult.columns" >{{column}}</ th > </ tr > </ thead > < tbody > < tr ng-repeat = "row in queryResult.rows.slice(((currentPage-1)*10), ((currentPage)*10)) track by $index" > < td ng-repeat = "cell in row track by $index" >{{cell}}</ td > </ tr > </ tbody > </ table > |
I using the currentPage variable from the Angular UI pagination component in combination with the javascript array slice method to split the result up in pages. Simple and efficient.
Here is a plunker with an example
The limitation of this being that you have to load the entire result at once. Pagination is entirely on the client side and not in the query.
Great blog. I had spent some time setting up the pagination. I did not think to insert a slice in the ng-repeat
ReplyDelete