jerkovicl
3/17/2016 - 1:36 PM

Simple load more function for ng-repeat with limitTo filter

Simple load more function for ng-repeat with limitTo filter

<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>
// set the default amount of items being displayed
$scope.limit= 5;

// loadMore function
$scope.loadMore = function() {
  $scope.limit = $scope.items.length
}