There's some hack so I can give a context to Template.contentBlock?


#1

As far as I know, you can’t pass a context to Template.contentBlock, 'cause the context that is automatically assigned to it is the one of the current invoker of the template.
Take an example:

    <template name="foo">
     {{> Template.contentBlock ..}} {{! `..` could be the helpers defined for `something`}}
    </template>
    Template.foo.helpers({ someFooHelper: =>(){} });

So if I call:

    <template name="home">
      {{#foo}}
        {{someFooHelper}} {{! doesn't work 'cause the context assigned here is the `home` one. }}
      {{/foo}}
    </home>

#2

You can definitely assign a context to Template.contentBlock as well as let it inherit it’s context from it’s parent. It doesn’t inherit helpers from the parent however so if you need the data from that helper you will need to pass it as an attribute.

<template name="foo">
    {{> Template.contentBlock someFooHelper=someFooHelper}}
</template>

#3

I didn’t realized that!
Thanks!