Question
Question

Reputation: 57

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.

Upvotes: 0

Views: 1184

Answers (2)

Anton
Anton

Reputation: 2585

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>

Upvotes: 0

ceth
ceth

Reputation: 45295

You can use limitTo:

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

Upvotes: 1

Related Questions