Search code examples
meteoriron-router

How to create a template helper pathFor path


Usually I just do {{pathFor 'dashboard'}}

But what if I get the path 'dashboard' from template helper as {{name}}

I can't do this{{pathFor '{{name}}'}} but I need to!

It's a submenu which looks like:

{{#each connectedChannels}} 
  {{> submenuChannel}} 
{{/each}}

<template name="submenuChannel">
    <li>
      <a href="{{pathFor '{{name}}'}}"><span class="sidebar-text">{{name}}</span></a>
    </li>
</template>

Solution

  • It should work if you remove the quotes and braces around name:

    <a href="{{pathFor name}}">