There are two valid ways to achieve this.
Dereference the parent scope with ../
By prepending ../
to the property name, you can reference the parent scope.
{{#each items}}
<div style="font-size:{{../itemSize}}px">{{this}}</div>
{{#if this.items.someKey}}
<div style="font-size:{{../../itemSize}}px">{{this}}</div>
{{/if}}
{{/each}}
You can go up multiple levels via repeating the ../
. For example, to go up two levels use ../../key
.
For more information, see the Handlebars documentation on paths.
Dereference the root scope with @root
By prepending @root
to the property path, you can navigate downwards from the topmost scope (as shown in caballerog’s answer).
For more information, see the Handlebars documentation on @data variables.