0

The problem: I have a table with a link-to within an each. I want the first cell of each row to have a checkbox strictly for toggling. I can display the checkbox, but I can't get it to let me check it.

<table class="table table-hover">
  <thead>
    <th></th>
    <th>Things</th>
    <th>Stuff</th>
<th></th>
   </thead>
  <tbody>
  {{#each myArr as |item|}}
          {{#link-to 'application' tagName='tr' }}
      <td><input type="checkbox"></td>

      <td>{{item}}</td>
      <td> Something</td>

          {{/link-to}}
  {{/each}}
  </tbody>
</table>
  • I don't want to go to the route
  • The checkbox needs to toggle
  • The checkbox doesn't need to hold a value (can be destroyed on page refresh)
  • Using the {{input}} helper makes no difference

I have a twiddle https://ember-twiddle.com/bc53d499687ad8bdc902be5cd7d77f48

D.Breen
  • 51
  • 2
  • 9

1 Answers1

1

You need to separate as components.

Please look at this twiddle

Ebrahim Pasbani
  • 9,168
  • 2
  • 23
  • 30
  • Thanks. That's a good solution. But how would I implement it in an array with any number of items. Like items from a database? Same thing? – D.Breen Jul 13 '16 at 03:42
  • Just tried it in production and it works. I ended up foregoing the component and just using an action in the controller. So it's ``. I should have mentioned that it's still Ember 1.10. Sadly just shy of a lot of cool stuff. Great job on providing a clear example! – D.Breen Jul 13 '16 at 04:06
  • @D.Breen Cool. Congrats – Ebrahim Pasbani Jul 13 '16 at 10:45