I would like to install a event handler to handle all <a class="nav" />
links. Currently I am providing the same entry for event maps in almost every template. So I get entries like
Template.XXX.events = {
'click a.nav' : linkCallback
}
all over the place. Is there a way to install event handlers globally? I couldn't find a way when looking at the documentation, but tmeasdays meteor-router seems to be able to do it. I just cant figure out how.
Just make a template that wraps every other template and attach the events to it:
<body>
{{> body}}
</body>
<template name="body">
</template>
Template.body.events = function() {
'click .nav': linkCallback
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With