Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/428.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 获取每个把手的父循环索引_Javascript_Ember.js_Handlebars.js_Template Engine_Helper - Fatal编程技术网

Javascript 获取每个把手的父循环索引

Javascript 获取每个把手的父循环索引,javascript,ember.js,handlebars.js,template-engine,helper,Javascript,Ember.js,Handlebars.js,Template Engine,Helper,这是我的结构 {{#each a in aa}} {{_view.contentIndex}} --> PARENT {{#each a in aa}} {{_view.contentIndex}} --> This should be the same PARENT val {{/each}} {{/each}} 问题是,在第二个循环中,我得到了当前范围的值,我需要得到父范围,在ember/Handlebar中有没有办法得到这个值?如果我理解正确,

这是我的结构

{{#each a in aa}}
     {{_view.contentIndex}} --> PARENT
  {{#each a in aa}}
      {{_view.contentIndex}} --> This should be the same PARENT val
   {{/each}}
{{/each}}
问题是,在第二个循环中,我得到了当前范围的值,我需要得到父范围,在ember/Handlebar中有没有办法得到这个值?

如果我理解正确,您应该能够做到:

{{#each parent}}
    {{_view.contentIndex}} --> PARENT
  {{#with parent}}
    {{#each otherThing}}
       {{_view.contentIndex}} This should be the same PARENT val
    {{/each}}
  {{/with}}
{{/each}}
最外层的循环将是父项

使用{{with}}的内部循环应该在每个单独父项内的每个项之间循环。

的可能重复项