Reputation: 2458
So i've got a structure like this
<template name="example">
{{#each post}}
<div class="hello"></div>
{{/each}}
</template>
So now I am trying to check for click events on the hello
div like so
Template.example.events = {
'click .hello' : function(event) {
console.log("hey");
}
}
But this is not working. Console is not logging anything.
Does this have to do anything with the change of context in the html template?
Upvotes: 0
Views: 49
Reputation: 7680
events
is a function that you need to pass an event map to. Right now you are assigning an event map and overriding the actual events
method. Try this:
Template.example.events({
'click .hello' : function(event) {
console.log("hey");
}
});
Upvotes: 1