I am using handlebars.runtime-v1.3.0
and I am not sure how to access parent object value in #each
. Here is my code:
data object:
var data = {
data : {
question : "work",
sub : "pref",
value : [0,1,2]
}
};
Template:
{{#each data.data.value}}
<div class="option" data-value="{{this}}" data-question="{{../question}}" data-subcat="{{../sub}}">
<img src="/images/image.png" alt="" class="image" />
<span class="style-name"></span>
</div>
{{/each}}
I am not able to get the values at {{../question}}
and {{../sub}}
.
I have been searching for the answer for 1 day and I found these links: link1, link2. None of them is working for me, so please don't mark the question duplicate on the basis of this.