title: How to pass a template variable to a template helper function to preserve context?
body: <p>I may be using the wrong words to describe my issue so here is the (simplified) code I'm working with.</p>
  
  <p>I'm happy to learn a better way to do this but what I'm currently trying to do is pass <code>{{assigneeId}}</code> to the template helper function called <code>agentIs</code>. The problem is that I can't find the correct way to pass the value.</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;template name="ticket_list"&gt;
    {{#each tickets}}
      {{&gt; ticket}}
    {{/each}}
  &lt;/template&gt;
  
  &lt;template name="ticket"&gt;
    &lt;h3&gt;{{title}}&lt;/h3&gt;
    &lt;p&gt;{{assigneeId}}&lt;/p&gt;
    {{&gt; ticket_footer}}
  &lt;/template&gt;
  
  &lt;template name="ticket_footer"&gt;
    {{&gt; agent_list}}
  &lt;/template&gt;
  
  &lt;template name="agent_list"&gt;
    &lt;!-- {{assigneeId}} exists here as expected --&gt;
    assigneeId: {{assigneeId}}
    &lt;label for="agent"&gt;Agent&lt;/label&gt;
    &lt;select id="agent" name="agent"&gt;
      {{#each agents}}
        &lt;!-- value passed: "{{assigneeId}}" --&gt;
        &lt;option value="{{_id}}" {{#if agentIs "{{assigneeId}}"}}selected{{/if}}&gt;
          {{profile.name}}
        &lt;/option&gt;
        &lt;!-- value passed: undefined --&gt;
        &lt;option value="{{_id}}" {{#if agentIs assigneeId}}selected{{/if}}&gt;
          {{profile.name}}
        &lt;/option&gt;
        &lt;!-- value passed: JSON.parse error --&gt;
        &lt;option value="{{_id}}" {{#if agentIs {{assigneeId}}}}selected{{/if}}&gt;
          {{profile.name}}
        &lt;/option&gt;
      {{/each}}
    &lt;/select&gt;
  &lt;/template&gt;
  </code></pre>
  
  <pre class="lang-js prettyprint-override"><code>Template.agent_list.agents = function() {
    return Meteor.users.find({"profile.is_agent": true}, {sort: {profile: 1}});
  }
  
  Template.agent_list.agentIs = function(assigneeId) {
    return this._id === assigneeId;
  };
  </code></pre>