Limiting number of displayed results when using ngRepeat Limiting number of displayed results when using ngRepeat javascript javascript

Limiting number of displayed results when using ngRepeat


Slightly more "Angular way" would be to use the straightforward limitTo filter, as natively provided by Angular:

<ul class="phones">  <li ng-repeat="phone in phones | filter:query | orderBy:orderProp | limitTo:quantity">    {{phone.name}}    <p>{{phone.snippet}}</p>  </li></ul>
app.controller('PhoneListCtrl', function($scope, $http) {    $http.get('phones.json').then(      function(phones){        $scope.phones = phones.data;      }    );    $scope.orderProp = 'age';    $scope.quantity = 5;  });

PLUNKER


A little late to the party, but this worked for me. Hopefully someone else finds it useful.

<div ng-repeat="video in videos" ng-if="$index < 3">    ...</div>


here is anaother way to limit your filter on html, for example I want to display 3 list at time than i will use limitTo:3

  <li ng-repeat="phone in phones | limitTo:3">    <p>Phone Name: {{phone.name}}</p>  </li>