express-handlebars
express-handlebars copied to clipboard
#each block ignored
Hi
I'm having an issue with the each block being ignored at render
as per the example here: http://handlebarsjs.com/builtin_helpers.html
res.render('home',{
helpers: {
people: [
"Yehuda Katz",
"Alan Johnson",
"Charles Jolley"
]
}
});
<ul>
<li>Test</li>
{{#each people}}
<li>{{this}}</li>
{{/each}}
</ul>
Renders this:
<ul>
<li>Test</li>
</ul>
Using [email protected]
Thanks for your time
you should either do {{#each helpers.people}} or move the people property outside the helpers object.
This drove me almost INSANE trying to resolve, I spent too much time looking into handlebars documentation to then come back and find this issue.
You should be having anything defined in 'helpers' bubble upwards automatically as this is not how handlebars normally works.