bminer / node-blade

Blade - HTML Template Compiler, inspired by Jade & Haml
Other
320 stars 28 forks source link

context data in event handler within "foreach" #130

Closed manuelbrunner closed 11 years ago

manuelbrunner commented 11 years ago

Using Blade (v3.0.0beta7) in Meteor, is there a way to access current object in each blocks within an event handler?

Meteor Template:

  {{#each groups}}
    <div class="delete">{{name}}</div>
  {{/each}}

Blade:

foreach groups as group
  .delete= group.name

Event Handler:

'click .delete': (event, template) ->
          console.log this

In Meteor Template I get the group object, in Blade I get the window object.

If there is no such feature yet in Blade:

bminer commented 11 years ago

@systemlord - this is actually a bug. So, yes. This feature will be added soon. Thanks for posting this issue!

bminer commented 11 years ago

@systemlord - please upgrade to the latest version of Blade and test. Please let me know whether or not it works. :)

manuelbrunner commented 11 years ago

It's working now. Thanks for the very fast fix. :)

bminer commented 11 years ago

No problem. Thanks for following up!