Skip to content

Instantly share code, notes, and snippets.

@darmie
Forked from fraserxu/loadMore.js
Created November 28, 2015 10:20
Show Gist options
  • Select an option

  • Save darmie/8e0a975fba9a6b85ae65 to your computer and use it in GitHub Desktop.

Select an option

Save darmie/8e0a975fba9a6b85ae65 to your computer and use it in GitHub Desktop.

Revisions

  1. @fraserxu fraserxu renamed this gist Aug 26, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. @fraserxu fraserxu created this gist Aug 26, 2014.
    7 changes: 7 additions & 0 deletions controller.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    // set the default amount of items being displayed
    $scope.limit= 5;

    // loadMore function
    $scope.loadMore = function() {
    $scope.limit = $scope.items.length
    }
    8 changes: 8 additions & 0 deletions template.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    <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>