Search code examples
meteormeteor-blaze

Meteor: why are template events available to 'sub-templates', but template helpers not?


If I have the following page structure:

<users template>
  <user template/>
  <user template/>
</user template>

Why is it that I can access Template.users.events({}) from within the <user template/>, but not Template.users.helpers({})?

I wish I could access helpers from 'holder' templates


Solution

  • Take a look at Template.registerHelper, this provides a way to create helpers that can be used across all templates.

    Template.registerHelper

    Parent events are triggered due to how events bubble up in javascript.