I am passing a list from Canjs javascript to an EJS template. This list can have more than 500 records but I want to restrict the iteration to display the first 50 records only, so how could I restrict the iteration to 50. Any ideas???
EJS template:
<ul>
<% list(items, function(item){ %>
<div class="text-center">
<span class="name"><%= item.attr('firstname') %>,<%= item.attr('lastname') %>
</span>
<span class="description"><%= item.attr('description') %></span>
</div>
<% }) %>
</ul>
Use items.slice(0, 50)
in place of items
.