1

I'm using Ember v1.13 and would like to render the checked attribute of an input element based on the result of an ember-truth-helpers expression. The following DID NOT work for me:

<input type="radio" checked={{(eq arg1 arg2)}}>

<input type="radio" checked={{if (eq arg1 arg2) true false}}>

Is there a way to do this, or do I have to resort to the following (which works)?

  {{#if (eq arg1 arg2)}}
      <input type="radio" checked>
  {{else}}
      <input type="radio">
  {{/if}}
sammy34
  • 5,312
  • 5
  • 29
  • 42

1 Answers1

2

Try this:

<input type="radio" checked={{eq arg1 arg2}}>

Or better, use {{input}} helper:

{{input type='radio' checked=(eq arg1 arg2)}}
Daniel Kmak
  • 18,164
  • 7
  • 66
  • 89