Context data passed to template

I just soved a puzzle and thought I would share: in the following example, the sub-template gets the context data from the parent

the template is called context and it is included inside another template

{{#with data}}
  <p>as template {{> context}}</p>
{{/with}}

but when you pass some parameters to the template, the context data gets lost:

{{#with data}}
  <p>as template {{> context titi="toto"}}</p>
{{/with}}

it is just something you have to know: either you pass all the data as parameter, or none of it. A mix of the two is not supported.

It is probably mentioned somewhere in the documentation but I have missed it.

1 Like