Reputation: 79
I'm getting a number back from json that represents the number of divs I need to create in my template. Is there a way to iterate and create the elements in the template based on this number using dust?
Upvotes: 0
Views: 127
Reputation: 6944
Please have a look at http://jsfiddle.net/yXx5L/2/.
real_no
is the number of times the template would be iterated.
based_on_number
is a helper method that iterates the template for real_no
times.
Upvotes: 0
Reputation: 5609
That's not possible. Dust only iterates over arrays. So, you could pass an array of the length you need.
Upvotes: 1