Spacebar as helper data context (Spacebar within spacebar)

I have tabs in my project that come from a database.
To each tab, several tags are allocated.

Is some how possible to generate the data context for the Iron Router’s pathFor helper from the data of an each loop.

something like this:

{{#each tabs}}
  <ul class="dropdown-menu">
    {{#each tags _id}}
    <li><a tabindex="-1" href="{{pathFor 'tag' tag={{name}} }}">{{name}}</a></li>
    {{/each}}
  </ul>
{{/each}}

Solution:

{{#each tabs}}
  <ul class="dropdown-menu">
    {{#each tags _id}}
    <li><a tabindex="-1" href="{{pathFor 'tag' tag=this.name }}">{{name}}</a></li>
    {{/each}}
  </ul>
{{/each}}

this forum really helps me all the time :smiley:

1 Like