title: handlebars - is it possible to access parent context in a partial?
body: <p>I've got a handlebar template that loads a partial for a sub-element.</p>
  
  <p>I would need to access a variable from the parent context in the calling template, from within the partial. <code>..</code> doesn't seem to resolve to anything inside the partial.</p>
  
  <p>Simplified code goes like this:</p>
  
  <p><strong>the template</strong></p>
  
  <pre><code>    {{#each items}} 
          {{&gt; item-template}}
      {{/each}}
  </code></pre>
  
  <p><strong>the partial</strong></p>
  
  <pre><code>    value is {{value}}
  </code></pre>
  
  <p>(obviously the real code is more complicated but it's the same principle, within the partial <code>..</code> appears to be undefined.)</p>
  
  <hr>
  
  <p>To show it's undefined, I've used a very simple helper <code>whatis</code> like this:</p>
  
  <pre><code>Handlebars.registerHelper('whatis', function(param) {
      console.log(param);
  });
  </code></pre>
  
  <p>and updated the above code to this:</p>
  
  <p><strong>updated template</strong></p>
  
  <pre><code>    {{#each items}} 
          {{whatis ..}}  &lt;-- Console shows the correct parent context
          {{&gt; item-template}}
      {{/each}}
  </code></pre>
  
  <p><strong>updated partial</strong></p>
  
  <pre><code>    {{whatis ..}}  &lt;-- Console shows "undefined"
      value is {{value}}
  </code></pre>
  
  <p>Is there a way to go around that issue? Am I missing something?</p>
  
  <p><strong>EDIT:</strong> There's an open issue relating to this question on <a href="https://github.com/wycats/handlebars.js/issues/182" rel="noreferrer">handlebars' github project</a></p>