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
since iterating over a string it will render an item for each char:
-
{{$index}} //THIS DOESN'T ANSWER OP'S QUESTION. Read below.
we can use this ugly but no-code workaround using the number|n decimal places
native filter.
-
{{$index}}
this way we'll have mynumber
elements with no extra code. Say '0.000'
.
We use mynumber - 2
to compensate 0.
It won't work for numbers below 3, but might be useful in some cases.