Skip to content

Instantly share code, notes, and snippets.

@maheshbabu
Forked from fraserxu/loadMore.js
Created July 27, 2016 15:33
Show Gist options
  • Save maheshbabu/b9cefb6c2732382f585a9ee02497705e to your computer and use it in GitHub Desktop.
Save maheshbabu/b9cefb6c2732382f585a9ee02497705e 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