Impossible to copy helpers between templates
mitar opened this issue · 5 comments
mitar commented
Previously, I could do:
Template.searchInput.indexHeader = Template.header.indexHeader;
Template.searchInput.noIndexHeader = Template.header.noIndexHeader;
Now this is not anymore possible, because helpers are not exposed easily. This makes code reusability harder.
raix commented
Thats a good point now you would have to declare these in a scope and add them as helpers. Does Template.foo.helpers()
extend the helpers or set the helpers?
mitar commented
Or maybe we are in general missing some extendable way to extend/mixin templates.
dandv commented
Can you share helpers as @raix suggested?
var myHelper = function () {
...
}
Template.foo.helpers({
helper1: myHelper,
...
}
Template.bar.helpers({
baz: myHelper,
...
}
mitar commented
The point is that the template might be implemented in 3rd party package and you do not have access to the function otherwise.
mitar commented
After some testing, I think meteor-template-extension is a good candidate to declare this issue solved. It really does the job.