I would like to add a counter in a table using Handlebars templating. I have a Handlebars template like so:
<script type="text/template" id="user-home-main-table-template">
<% var i=0 %>
<table class="table">
<thead>
<tr>
<th>#</th>
<th>Team Name</th>
<th>Club</th>
<th>Sport</th>
<th>Delete?</th>
</tr>
</thead>
<tbody>
{{#teams}}
<tr>
<td><%=i%></td>
<td>{{teamName}}</td>
<td>{{club}}</td>
<td>{{sport}}</td>
<td>delete</td>
</tr>
{{/teams}}
</tbody>
</table>
</script>
this works, but the variable i doesn't increment, what's the best way to solve this problem?