These docs are for v3.5. Click to read the latest docs for v5.0.

Discussions

Ask a Question
Back to All

Chained/Nested Helpers Inside {{each}} Don't Work

Is this a bug?

I have the following code that works without issue.

{{#equal Settings.Setting1 "value1"}}
{{#equal Settings.Setting2 "value2"}}

I can see this rendered.

{{/equal}} {{/equal}}

However, the following example will not rended properly.

{{#each Items}}
{{#equal ../Settings.Setting1 "value1"}}
{{#equal ../Settings.Setting2 "value2"}}

This does not get rendered.

{{/equal}} {{/equal}} {{/each}}

I know the values are there and are being called correctly (since the path is off a level due to the {{each}} loop. This works on its own, outputting the expected setting values.

{{#each Items}}
{{../Settings.Setting1}}
{{../Settings.Setting2}}
{{/each}}

This doesn't even work...

{{#each Items}}
{{#equal ../Settings.Setting1 "value1"}}{{../Settings.Setting1}}{{/equal}}
{{#equal ../Settings.Setting2 "value2"}}{{../Settings.Setting2}}{{/equal}}
{{/each}}

Oddly enough, this works though...

{{#each Items}}
{{#equal ../Settings.Setting1 "value1"}}I see this...{{/equal}}
{{#equal ../Settings.Setting2 "value2"}}... and this too{{/equal}}
{{/each}}

In a final related test, this doesn't work.

{{#each Items}}
{{#equal ../Settings.Setting1 "value1"}}
I see this...
{{#equal ../Settings.Setting2 "value2"}}
... but not this one!!!
{{/equal}}
{{/equal}}
{{/each}}

Does anyone know why this works consistently outside of the {{each}} but not inside of it?