Does Spacebars support {{#each item in list}} form?


#1

According to this: https://github.com/meteor/meteor/blob/devel/packages/spacebars/README.md

Spacebars supports the following form of {{#each}}:

<ul>
{{#each person in people}}
  <li>{{person.name}}</li>
{{/each}}
</ul>

Which “doesn’t change the data context but introduces a new variable that can be used in the body to refer to the current item.”

But this doesn’t seem to be working for me.

Now, the link above is on the devel branch, so maybe this new variant is not released yet?

Has anyone used this?


#2

The above code was listed in the changelogs…


#3

In Meteor 1.1 it does not work, I read somewhere that the docs were incorrect, as this in keyword never managed to get into production.

Maybe it’s working in 1.2 now.


#4

Yeah it was listed among new features for Blaze that came with Meteor 1.2. Though I prefer the old syntax, so I didn’t have the opportunity to test it in real use. I worry more about @index that came together with this syntax and which I failed to make working since then - I still have to use the old way with mapping.


#5

Okay. Sounds like it’s 1.2 (which I haven’t quite jumped to yet). That make sense. Thanks.