express-handlebars icon indicating copy to clipboard operation
express-handlebars copied to clipboard

how to access parent variable in #each that in partials?

Open lambdaxs opened this issue 8 years ago • 1 comments

res.render('index',{
  list:[{
    color:'red'
},{
    color:'white'
}],
  name:'tom'
})

//index.hbs
{{#each list}}
{{> template}}
{{/each}}

//template.hbs (in partials dir)
<h5>{{color}} {{../name}}</h5>

//result html
<h5>red</h5>
<h5>white</h5>

//can not access parent value 'tom' \(^o^)/~

lambdaxs avatar Nov 23 '16 09:11 lambdaxs

Same issue ! did you have any news ?

n-dragon avatar Mar 28 '17 12:03 n-dragon