Is there a way to ng-repeat
a defined number of times instead of always having to iterate over an array?
For example, below I want the list item to show
I am creating a reusable directive where the max number will come from another ng-repeat. So, this is an edit over the best voted answer.
Just change the code at controller to this -
$scope.getNumber = function(num) {
var temp = [];
for(var j = 0; j < num; j++){
temp.push(j)
}
return temp;
}
This will return a new array with specified number of iterations