문제

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!";
};
도움이 되었습니까?

해결책

You can use Handlebars.registerHelper just like this :

Handlebars.registerHelper("eventTitle",function(){
    return "Title!";
});

다른 팁

In Meteor 1.0 use Template.registerHelper(name,function) to register a global template helper.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top