When you have plenty of records to show, you don't need to show them all at a time. We should show them based on user interest. Here I implemented the program to show the records with " Load more records " feature.

Markup

Here We are using limitTo filter control the number of records to display. Whenever user clicks on below button, record limit will be increased and more records will be displayed.
<div ng-repeat="record in records | limitTo:recordLimit">
  {{record}}
</div>
<button ng-show="records.length > recordLimit" ng-click="recordLimit = recordLimit + 5">show more records</button>

Script

Here we are initiating the records and record limit
$scope.records = [];
$scope.recordLimit = 5;
for(var i=0;i<20;i++) {
   $scope.records.push('record '+i);     
}

0 comments:

Blogroll

Follow this blog by Email

Popular Posts