Search code examples
meteoriterationmeteor-blaze

Iterative Ids in Meteor Blaze


Really need help with this. If I am iterating using

{{#each items}}

<li id={{some_blaze_tag}}></li>

{{/each}}

How do I get this result?

<li id="1">item 1</li>
<li id="2">item 2</li>
<li id="3">item 3</li>

I'm pretty sure Ruby has an equivalent, and I can't seem to do the same in Meteor.

Help would be really appreciated! thank you!


Solution

  • Blaze also has this support. within your #each loop , you have @index access which is an incremental counter basically.

    <li id={{@index}}>Item {{@index}}</li>