title: Conditional "if statement" helper for Handlebars.js
body: <p>I am trying to write a conditional if statement helper for Handlebars.js. Essentially, I want to put an "active" class on a link if it is the <code>Apply Now</code> page.</p>
  
  <p>Helper:</p>
  
  <pre><code>  Handlebars.registerHelper('isApplyNow', function(block) {
      if(this.title == "Apply Now") {
        return block(this);
      } else {
        return block.inverse(this);
      }
    });
  </code></pre>
  
  <p>And Template: </p>
  
  <pre><code>  &lt;ul&gt;
      {{#each pages}}
        &lt;li&gt;
          {{#isApplyNow}}
            &lt;a href="{{url}}" class ='active'&gt;{{this.title}}&lt;/a&gt;
          {{else}}
            &lt;a href="{{url}}"&gt;{{this.title}}&lt;/a&gt;
          {{/if}}
        &lt;/li&gt;
      {{/each}}  
    &lt;/ul&gt;
  </code></pre>
  
  <p>But, I am getting a very bare-bones javascript error:</p>
  
  <pre><code>Uncaught [object Object] in handlebars-1.0.0.beta.2.js:595
  </code></pre>
  
  <p>Can anyone see if I am writing this improperly?</p>
  
  <p>Thanks!</p>
  
  <p>Referenced articles: </p>
  
  <p><a href="https://stackoverflow.com/questions/6319231/calling-helper-within-if-block-in-handlebars-template">Calling Helper Within If Block in Handlebars Template</a></p>
  
  <p><a href="http://thinkvitamin.com/code/handlebars-js-part-2-partials-and-helpers/" rel="nofollow noreferrer">http://thinkvitamin.com/code/handlebars-js-part-2-partials-and-helpers/</a></p>