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 wanted to keep my html very minimal, so defined a small filter that creates the array [0,1,2,...] as others have done:
angular.module('awesomeApp')
.filter('range', function(){
return function(n) {
var res = [];
for (var i = 0; i < n; i++) {
res.push(i);
}
return res;
};
});
After that, on the view is possible to use like this:
-
{{i+1}}