I couldn't find a solution for this particular issue, although I have encountered it in the past.
The challenge is to render a template with a variable set from HTML and also be able to access it in JavaScript. Here's a straightforward example that addresses both scenarios:
<template name="a">
{{>b param="hello"}}
</template>
<template name="b">
{{param}} {{param2}}
</template>
Template.b.param2 = function() {
if (this.param == "hello") {
return "world"
}
}
Unfortunately, it seems like this code snippet is not functioning as expected.
EDIT:
It turns out everything is actually working fine. The oversight was in omitting the #each
:
<template name="a">
{{>b param="hello"}}
</template>
<template name="b">
{{#each something}}
{{param}}
{{/each}}
</template>
I believe that's where the issue lies. (apologies for the simplistic nature of this example)