You can use Handlebars.registerHelper just like this :
Handlebars.registerHelper("eventTitle",function(){
return "Title!";
});
Domanda
I find myself doing this a lot:
{{> eventTitle}}
<template name="eventTitle">
{{eventTitle}}
</template>
Is there a way to cut out the template and just do:
{{eventTitle}}
Then in the js file:
Template.eventTitle.eventTitle = function () {
return "Title!";
};
Soluzione
You can use Handlebars.registerHelper just like this :
Handlebars.registerHelper("eventTitle",function(){
return "Title!";
});
Altri suggerimenti
In Meteor 1.0 use Template.registerHelper(name,function) to register a global template helper.