I’m trying to copy as much as I can from the documentation, though I’m working with handlebars.js in a rails app with backbone.
I have a collection taken right from the handlebars examples.
var list = { people: [
{name: "Alan"},
{name: "Allison"},
{name: "Ryan"}
], group: "Bloggers" };
I pass this collection to handlebars as
if(list.people.length >0){
var showList = HandlebarsTemplates['htmlList'](list);
console.log(showList);
$('div#holdList').html(showList);
}
},
in my hbr file, I have
<ul>
this gets output
{{#each list.people}}
this doesn't, but should. <br/gt;
{{/each}}
</ul>
My output shows the ‘this gets output’, but I can’t get handlebars to enter the loop and show ‘this doesn’t but should.’
what am I doing wrong??
You should iterate over people and not list.people in your template.