Hi everyone,
for some reason, i need to add an event handler to a template through an helper. Is it even possible ?
To complicate things, the event handler “key” should be dynamically generated.
I have tried this:
Template.foo.helpers({
setter : function(id){
var instance = Template.instance();
var key = "click " + "#" + id;
var eventsMap = {};
eventsMap[key] = function(){
//doStuff....
}
instance.events(eventsMap);
}
});
The problem is that it doesn’t work.
The instance variable doesn’t have any “events” method.
Is there a solution ?
Thanks in advance.