Passing empty object context to a template


#1

I’d like to pass an empty object to a template.

<template name="parent">
    {{field_in_parent}}
    {{#each children}}
    {{> children_template }}
    {{/each}}
    <!-- empty object to allow a new children to be created -->
    {{> children_template EMPTY_OBJECT_PLEASE}}
</template>

Any suggestions?


#2
<template name="parent">
  {{field_in_parent}}
  {{#each children}}
    {{> children_template child=this}}
  {{/each}}
  {{> children_template child=null}}
</template>

#3

Won’t it create a parent with context {child: theChild} and {child: null}? That is almost the same, but isn’t that possible to use implicit context (no context change in each block)?


#4
<template name="parent">
  {{field_in_parent}}
  {{#each children}}
    {{> children_template}}
  {{/each}}
  {{#with null}}
    {{> children_template}}
  {{/with}}
</template>

#5

Thanks, almost. But the context itself is null, it just somehow defaults to empty object (could not modify it)