Skip to content

Instantly share code, notes, and snippets.

@darmie
Forked from fraserxu/loadMore.js
Created November 28, 2015 10:20
Show Gist options
  • Save darmie/8e0a975fba9a6b85ae65 to your computer and use it in GitHub Desktop.
Save darmie/8e0a975fba9a6b85ae65 to your computer and use it in GitHub Desktop.
Simple load more function for ng-repeat with limitTo filter
// set the default amount of items being displayed
$scope.limit= 5;
// loadMore function
$scope.loadMore = function() {
$scope.limit = $scope.items.length
}
<ul class="lists">
<li ng-repeat="item in items | limitTo:limit">
<span>{{item.name}}</span>
</li>
<li>
<button ng-click='loadMore()'>Load More</button>
</li>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment