I have model:
[
{
"ID": 5,
"email": "xx@vflbg.com"
},
{
"ID": 6495,
"email": "email@monkey.com"
}
]
Code for iterating in handlebars:
{{#each xxx}}
<p>{{email}}</p>
{{/each}}
how do I define xxx ?
If JSON had name in model like:
users: [
{
"ID": 5,
"email": "xx@vflbg.com"
},
{
"ID": 6495,
"email": "email@monkey.com"
}
]
I would simple iterate in handlebars like:
{{#each users}}
<p>{{email}}</p>
{{/each}}
If you have this:
Then just supply the desired name when you call the compiled template:
That will leave you with your desired HTML in
h.Demo: http://jsfiddle.net/ambiguous/ZgVjz/
If you have a collection built from the data:
Then you’d call the template like this:
Demo: http://jsfiddle.net/ambiguous/uF3tj/