Sunday, March 29, 2015

Meteor template events and topmost element

While writing a custom template, I discovered that events from the topmost element in the template are not caught by template.events which is a strange but workable issue in Meteor. Just wrap the whole body within a dummy div as shown:

<template name="sometemplate">
<div>
<div class="eventSource"> ... </div>
</div>
</template>

Template.sometemplate.events({ 'click .eventSource': function(event, template) {
...
}
});

No comments:

Post a Comment