0

this is my structor

{{#each a in aa}}
     {{_view.contentIndex}} --> PARENT
  {{#each a in aa}}
      {{_view.contentIndex}} --> This should be the same PARENT val
   {{/each}}
{{/each}}

The problem is that i that in the second loop i'm getting the value for the current scope, buy i need to get the parent scope, is there a way in ember/handlebars to get this?

alexmorgan.cr
  • 270
  • 6
  • 18
  • possible duplicate of [Handlebars.js: How to access parent index in nested each?](http://stackoverflow.com/questions/14854491/handlebars-js-how-to-access-parent-index-in-nested-each) – thecodejack Sep 25 '14 at 11:52

1 Answers1

2

If I understand the documentation correctly, you should be able to do this:

{{#each parent}}
    {{_view.contentIndex}} --> PARENT
  {{#with parent}}
    {{#each otherThing}}
       {{_view.contentIndex}} This should be the same PARENT val
    {{/each}}
  {{/with}}
{{/each}}

the outermost loop will be the parent items.

the inner loop using {{with}} should loop through each item inside of each individual parent.

Grapho
  • 1,654
  • 15
  • 33