Registering helper with current route returns error in console:
Exception in template helper: TypeError: Cannot read property 'getName' of undefined
And after Router is loaded - works fine. How to get rid of this console error?
Helper code:
if (Meteor.isClient) {
// create global {{route}} helper
Handlebars.registerHelper('route', function () {
return Router.current().route.getName();
});
}
Use technique called guarding: