Steering wheel variables

I pass the models to the handlebars template and put some properties in a string. I want to have some kind of position variable for each row. In particular, I want to know how many lines were created and have a position associated with each line.

eg.

{{#each row}}
<span class = (indexHere)>
  <tr>
     <td> <{{this.property}}>
  </tr>
</span>
{{/each}}
+5
source share
2 answers

This is an old question, and maybe at that time Handlebars did not include the property @index, but according to the current (1.3.0) documentation:

When navigating through elements in, eachyou can refer to the current loop index through{{@index}}

+5
source

You create your own helper :-)

Here you can steal: https://gist.github.com/1048968

+3
source

All Articles