This simple example {{#if}} inside {{#each}} leads to an unexpected (for me) result:
HTML:
<head>
<title>test</title>
</head>
<body>
{{> test yes=true}}
</body>
template name="test">
{{#if yes}}
<span>yes</span>
{{else}}
<span>no</span>
{{/if}}
<ul>
{{#each testItems}}
{{#if yes}}
<li>yes</li>
{{else}}
<li>no</li>
{{/if}}
{{/each}}
</ul>
</template>
JS:
Template.test.helpers({
testItems: [1,2,3]
});
Conclusion:
Yes
I was expecting a list with 3 x yes ...
What is wrong with this code?
source
share