{{_.each(model, function(item) { }}
<h5 style="color:#F30;">{{=item.name}}</h5>
{{for (i = 0; i < item.subcollection.length; i++) { }}
<li><a>{{=item.subcollection[i].split('#')[0]}}</a></li>
{{ } }}
{{ });}}
I have underscore template for rendering backbone model collection which contains a subcollection inside.But i need render only first 3 collection while rendering. ny help
i am not sure what you are trying to do but if you want only first three to be executed set the counter value to 3 instead collection.length
{{for(j=0;j<3;j++){ }}
<h5 style="color:#F30;">{{=model[j].name}}</h5>
{{for (i = 0; i < model[j].subcollection.length; i++) { }}
<li><a>{{=model[j].subcollection[i].split('#')[0]}}</a></li>
{{ } }}
{{ } }}
note : make sure the length is at least 3.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With