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
There are many ways to do this. I was really bothered at having the logic in my controller so I created a simple directive to solve the problem of repeating an element n-times.
Installation:
The directive can be installed using bower install angular-repeat-n
Example:
{{$index}}
produces: 1234
It also works using a scope variable:
Source:
Github