I’m using the new {{#each .. in}}
syntax to render a grid of projects. It looks like this:
{{#each projects}}
<div class="project">
<div class="meta">
<h6>{{client.name}}</h6>
{{name}}
</div>
<div class="blocks">
{{#each block in blocks}}
<div class="{{block.label}}">
...
</div>
{{/each}}
</div>
</div>
{{/each}}
When clicking on a block in the grid, the app should navigate to a page specific for that block. The new each in
syntax was ideal, because otherwise I had no way of getting to the project data (without breaking up the template). Now, I can get to the project via this
, but how do I find out what the value of block
was in the event handler? Without this, this syntax would be a lot less useful I think… Hope I’m missing something
Template.Grid.events
'click .blocks div': ->
this # project Document object, yay!
Template.scope( 'block' ) # block?