K
K
kolyalesha2015-04-21 09:03:42
Angular
kolyalesha, 2015-04-21 09:03:42

How can I duplicate a block n times without data binding using ng-repeat?

How can I duplicate a block n times without data binding using ng-repeat ? The examples show such a loop for(item in list){ } , how to specify such a for(var i = 0; i < 5; ++i ) { } ?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
kompi, 2015-04-21
@kompi

<div ng-repeat="item in list | limitTo: 3"></div>

S
Sergey, 2015-04-21
@TsarS

You can use limit and slice if you need to limit the data, you can do this jsfiddle.net/digitalzebra/wnWY6

L
lega, 2015-04-21
@lega

Angular Light has a convenient filter for this:
<div al-repeat="i in 5 | generator"></div>in this example, the result will be 5 elements, you can do an analogue for ng.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question