New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nested iteration with ability to access parent #129
Comments
One simple approach would be to register a helper: {{#each animals}}
{{#each organs}}
{{get .. this}}
{{/each}}
{{/each}} Handlebars.registerHelper('get', function(obj, prop) {
return obj[prop];
}); |
Sorry to bring this issue back up, but I don't see how this 'get' helper will give access to the parent unless we create circular references. Could you expand on what you mean by "{{get .. this}}"? If this is an organ, how can we use that to find the parent animal? I would like to use handlebars.js to iterate over a list of families, and then iterate over that family's members. Inside of both loops, I want to display properties of both. However, once I get into the second iteration, none of the family variables are visible.
Is this possible with handlebars? If not, that's OK. I'd greatly appreciate any help! |
{{#each families}}
{{#each members}}
<p>{{ ../surname }}</p>
<p>{{ name }}</p>
{{/each}}
{{/each}} |
hello guys i am learning node/express right now, the code above wont work for me i am using express-handlebars, can you help me? Is this possible with express-handlebars? here's my code. the gpareaData is iterating but the branch is not
|
{{#allData}} {{#ifEqual id course_id }} {{title}}{{else}} {{title}}{{/ifEqual}} {{/assignedData}} {{/allData}} My app control is nor even entering the inner loop . Just printing all all all Can you tell me why? |
Please see the issue here http://stackoverflow.com/questions/552934/what-javascript-templating-engine-do-you-recommend/7812081#7812081
The text was updated successfully, but these errors were encountered: