I'm working on a Handlebars project and trying to use an inline partial. I'm trying to access the key
parameter from within a loop.
{{#*inline "myPartial"}}
<div class="actionOverlay">
{{#each (lookup items key) }}
<span class="{{classes}} key-{{key}}" title="{{title}}"></span>
{{/each}}
</div>
{{/inline}}
And then invoking this inline partial with {{> myPartial key="0R"}}
. The variable items
is an array of objects with classes
and title
as keys.
Unfortunately {{key}}
renders as empty string, no doubt because there is no key
key in the items
objects. I've also tried {{@root.key}}
and that doesn't work.
How can I access the partial's parameter from within the loop?
Please note that I'm not trying to use a partial from within a loop, but trying to use a loop in a partial and to access the partial's parameter from within the loop.