In the Meteor docs http://docs.meteor.com/#eventmaps it states “http://docs.meteor.com/#eventmaps” and the tutorials show Templates taking events such as with.
Template.template1.events = {
'click #btnSubmit': function (event) {
//do something
}
};
Template.template2.events = {
'click #btnSubmit': function (event) {
//do something
}
};
I don’t want have to create this boilerplate for each of my Meteor Templates that has a submit button. I would rather have one event handler for all forms and all submit buttons.
How can I have a single click handler? or other event handlers for that matter?
I think all you can do is create the function elsewhere and just use it as the callback for each separate template’s event: