Skip to content
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

Question regarding multi-level each #582

Closed
Jezternz opened this issue Jul 24, 2013 · 1 comment
Closed

Question regarding multi-level each #582

Jezternz opened this issue Jul 24, 2013 · 1 comment

Comments

@Jezternz
Copy link

Hi, I am looking for a templating engine and handlebars looks pretty great!
However I have some rather advanced requirements and I am not sure if handlebars is capable, or if it is,
what the syntax should look like. I have tried below to describe my problem.
eg given the following json structures:

var x = [{"XX":1},{"XX":3}];
var z = [
  "a":{
    1:{"Q":"A"},
    2:{"Q":"B"},
    3:{"Q":"C"},
    4:{"Q":"D"}
  }
];

I need to be able to template something like this:

<ul>
{{#each x}}
  {{#each z.a.(this.XX).Q}}
    <li>Item - {{this}}</li>
  {{/each}}
{{/each}}
</ul>

// Where 'this' refers to the element from the most outer loop
and output something like this:

<ul>
  <li>Item A</li>
  <li>Item C</lI>
</ul>

Any ideas on whether this is possible and what the template syntax should look like would be great! (Or any plans for future implementation).

@kpdecker
Copy link
Collaborator

This is basically the same issue as #569. We don't currently support index type operators but helpers can provide this in the mean time as discussed over there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants