title: Calling Helper Within If Block in Handlebars Template
body: <p>I am working with Handlebars.js template engine and am trying to figure out a way to do something like this (contrived example):</p>
  
  <pre><code>{{#if itemSelected "SomeItem"}}
      &lt;div&gt;This was selected&lt;/div&gt;
  {{/if}
  </code></pre>
  
  <p>where <code>itemSelected</code> is a registered helper like this:</p>
  
  <pre><code>Handlebars.registerHelper("itemSelected", function(item) {
      var selected = false;
      // Lots of logic that determines if item is selected
      return selected;
  });
  </code></pre>
  
  <p>I get errors when trying to use this syntax for the template, and I cannot find any example showing this kind of thing. I do see simple #if blocks like this...</p>
  
  <pre><code>{{#if myValueInContext}}
      &lt;div&gt;This will show if myValueInContext results in a truthy value.&lt;/div&gt;
  {{/if}}
  </code></pre>
  
  <p>But, I can't figure out how to tackle the first example. Maybe I am approaching this wrong.</p>
  
  <p>By the way, I tagged this Mustache as I could not add a Handlebars tag to the question.</p>