Reputation: 805
Is there way to get access to the helpers of the parent template while I'm in an #each loop?
<template name="template2">
{{test}}<br/>
{{#each list}}
{{this}}:{{../test}}<br/>
{{/each}}
</template>
The first {{test}} works, the one in the loop does not. I've also tried {{../this.test}} unsuccessfully in case that was the answer.
Does the .. syntax not work here? I've found this answer, which seems to suggest that it does, but as you can see in this meteorpad it doesn't.
Upvotes: 0
Views: 346
Reputation: 64312
The title of the question indicates a parent-child relationship, however in the example there is only one template. Helpers are available to the whole template, so the context doesn't matter in this case. Just use {{test}}
like this:
<template name="template2">
here:{{test}}<br/>
{{#each list}}
{{this}}:{{test}}<br/>
{{/each}}
</template>
Upvotes: 2