Template7 #each - 'this' of parent

Hi,

Template7, I want to get the parent context’s ‘this’ in nested #each.

Can I do that?


eg.: ArrayA = [ “A”, “B”, “C” ];

{{#each ArrayA}}

  {{ this }} // prints "A", "B", "C"

  {{#each ArrayB}}

     {{../this}} // want to print what in ArrayA, but it outputs 'this' of ArrayB

  {{/each}}

{{/each}} 

https://idangero.us/template7/

Expressions syntax

Template7 support expressions with the following syntax:

Variables:

  • {{title}} - plain variable. Outputs “title” variable in current context
  • {{../title}} - plain variable. Outputs “title” variable in parent context
  • {{../../title}} - plain variable. Outputs “title” variable in parent context of parent context
  • {{this}} - plain variable. Outputs variable equals to current context

By the way, “…/@index” works, (2 dots, this forum converts 2 dots to 3 dots)

{{#each ArrayA}}
  {{#each ArrayB}}
     {{../@index}} - {{@index}}
  {{/each}}
{{/each}}

prints
0-0
0-1
0-2
1-0
1-1
1-2

my workaround is:

ArrayA = [
 {t:"A"},
 {t:"B"},
 {t:"C"},
];


{{#each ArrayA}}

  {{ t }} // prints "A", "B", "C"

  {{#each ArrayB}}

     {{../t}} // prints "A", "B", "C"

  {{/each}}

{{/each}} 

but I still want to know if there is a way to access “…/this” .