Search code examples
javascriptmeteoronloadiron-router

Is there a global rendered function in Meteor?


I'm wondering if there is something like a global version of the Template.myTemplate.Rendered in Meteor. I would like to attach all of my global GUI specific Javascript (scroll-top animations, custom checkboxes etc.) without attaching it to every single template manually. I tried calling it from the layout, but it didn't seem to work. What am I doing wrong? I'm using iron router btw.

Cheers & thanks


Solution

  • If you have a layout that is shared across many pages or even your whole app you can also attach handlers to that. A template that embeds another template that embeds another template is fine, each of those will get a rendered event.