简体   繁体   中英

Load more data from local array in AngularJS

Question: I had array of objects for ex: listArray[].

var listArray =[];

in that array i have 1000 objects, i want show 10 objects in table. and below the table

"Load More Data" button. when I click on Load more data button i need show next 10 objects in that table, pervious 10 objects should be scroll up. using AngularJS.

any one please help me.

您可以使用limitTo:

<li ng-repeat="element in listArray | limitTo:limit">

hope it helps out

<table ng-init="start=10">
...
  <tr ng-repeat="element in listArray.splice(0, start)" >
  ...
  </tr>
...
</table>
....
<button ng-click="start=start + 10" ng-disabled="start > listArray.length">Load More Data</button>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM