title: Check for equality in Spacebars?
body: <p>I am trying to do what I think should be a very simple task, but have been failing to do so in the past hour. I want to select a select option by default if the user property matches the value.</p>
  
  <pre><code>&lt;select name="myName"&gt;
    {{#each addKeys myTable}} &lt;!-- addKeys creates variables for keys and values --&gt;
      &lt;option value="{{key}}" {{#if currentUser.property === key}}selected="selected"{{/if}}&gt;{{value}}&lt;/option&gt;
    {{/each}}
  &lt;/select&gt;
  </code></pre>
  
  <p>Now I thought this was straightforward enough to be implemented. But it turns out that Spacebars do not allow conditional operators other than the negation exclamation mark, so equal signs are out of question. I then tried something horrible for the sake of trying:</p>
  
  <p>In template <code>myTemplate</code>:</p>
  
  <pre><code>&lt;select name="myName"&gt;
    {{#each addKeys myTable}}
      &lt;option value="{{key}}" {{isSelected currentUser.property key}}&gt;{{value}}&lt;/option&gt;
    {{/each}}
  &lt;/select&gt;
  </code></pre>
  
  <p>In <code>mytemplate.js</code> :</p>
  
  <pre><code>Template.myTemplate.helpers({
    isSelected: function(v1, v2) {
      if (v1 === v2)
        return "selected=\"selected\"";
      return '';
    }
  });
  </code></pre>
  
  <p>Not only is this code terrible, terrible to look at, it does not work:</p>
  
  <pre><code>Exception in Meteor UI: String contains an invalid character
  </code></pre>
  
  <p>I don't understand why something that simple seems so impossible to achieve. Am I missing something there?</p>