context data in event handler within "foreach" #130

Closed
manuelbrunner opened this Issue Feb 3, 2013 · 4 comments

2 participants

@manuelbrunner

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:

  • Is this feature planned (would be really helpful)?
  • is there a best practice to get the object id in the event handler (something like appending ID to DOM and traversing DOM)?
@bminer bminer was assigned Feb 3, 2013
@bminer
Owner

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

@bminer bminer added a commit that closed this issue Feb 3, 2013
@bminer Fixed #130. Push to 3.0.0rc1. 08b5622
@bminer bminer closed this in 08b5622 Feb 3, 2013
@bminer
Owner

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

@manuelbrunner

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

@bminer
Owner

No problem. Thanks for following up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment