Reputation: 103
Is there a way to type:
<div ng-repeat="item in items | limitTo:what">
where I can substitute "what" with something that will make it iterate through the whole list of items. (note items.length is not what I am searching for.. or it must be with some ugly if inside the html).
Upvotes: 1
Views: 176
Reputation: 67296
In the source for limitTo
there is support for an infinite number (Infinity
):
if (Math.abs(Number(limit)) === Infinity) {
limit = Number(limit);
} else {
limit = int(limit);
}
Looks like you should be able to set to Number.POSITIVE_INFINITY
.
However, the resulting code would probably be no better than using items.length
. And would certainly be less understandable.
Upvotes: 1
Reputation: 2962
This is simple man
<div ng-repeat ="item in items | limitTo:10">
or $scope.what = '10'; and use what in limit.
Upvotes: 0
Reputation: 21901
you don't need {{ }}
, here is the documentation
<div ng-repeat="item in items | limitTo:what">
in the controller
$scope.what = 3; // iterate only 3
Upvotes: 0