Skip to content
This repository

context data in event handler within "foreach" #130

Closed
manuelbrunner opened this Issue · 4 comments

2 participants

Manuel Brunner Blake Miner
Manuel Brunner

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)?
Blake Miner
Owner

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

Blake Miner
Owner

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

Manuel Brunner

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

Blake Miner
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
Something went wrong with that request. Please try again.