I’ve got a nested #each
loop and the inner loop needs some info from the outer loop. To best explain, here’s the working code (using Meteor v.NEXT from github):
{{#each filteredCollection}} //returns simple array like ["client", "vendor"]
{{#with idx=@index heading=this}}
{{#if filteredItems}} ///needs the @index in its helper function
{{#let heading=heading}}
{{#each filteredItems}}
{{#with doc=this heading=heading}}
{{>filteredItem}} //needs heading & the document
{{/with}}
{{/each}}
{{/let}}
{{/if}}
{{/with}}
{{/each}}
As shown, this works perfectly. I needed to use a #let
to permeate the #each block, and then a #with
once inside to give it context. This seems really hacky to me, is there a better way to do it?