I'm trying to create a loop that prints HTML a certain number of times. I know the number because its in the scope. Must I loop through the numbers and push them into an array beforehand in order to use ng-repeat which seems to only accept collections?
-
You want to avoid the loop or the array creation ?? – Manish Kr. Shukla Aug 14 '14 at 5:10
-
I am trying to avoid having to create an extra loop by building an array for ng-repeat to loop through. – neptunian Aug 14 '14 at 5:14
-
This might help: stackoverflow.com/questions/11873570/… – runTarm Aug 14 '14 at 5:18
-
ngRepeat is basically a directive. If you tend to use your functionality many times in the project, you may consider creating the directive with intended functionality as yours. – skjoshi Aug 14 '14 at 5:22
-
Possible duplicate of Way to ng-repeat defined number of times instead of repeating over array? – stamat Mar 21 '16 at 14:04