Handlebars.js: How to access parent index in nested each?

后端 未结 5 1320
情歌与酒
情歌与酒 2020-12-12 20:57

How to access parent @index value in each-loop?

Tried the following:

{{#each company}}
{{#each employee}}
  {{../@index}} // how to access company in         


        
5条回答
  •  既然无缘
    2020-12-12 21:08

    There is a syntax error in the example. The correct syntax is {{@../index}}.

    We are looking at ways that we can support custom naming of these parameters in future versions of the language so this is easier to deal with. https://github.com/wycats/handlebars.js/issues/907

提交回复
热议问题