I have been added to project with ember. Unfortunetly I only know AngularJS. Anyway what I have to do is to add onclick event on checkbox. I've tried to use observer but without much success (probably because input is generated via iteration). Heres the code
{{#each prod in allProducts}}
<tr>
<td class="checkbox-event" selenium-id="check">{{input type=checkbox checked=prod.selected id=prod.id}}</td>
<td selenium-id="id">{{prod.productNumber}}</td>
<td selenium-id="name">{{prod.name}}</td>
<td selenium-id="category">{{prod.mainCategoryName}}</td>
<td selenium-id="price">{{prod.mainPrice}}</td>
</tr>
{{/each}}
What I need to do is to add click event on input that will call some function with prod
as argument. I have only found answers for 'normal' input but not the one above.
You have several problems:
each prod in allProducts
is wrong. Use {{#each allProducts as |prod|}}
type=checkbox
is wrong. Use type="checkbox"
you can use change
action.
Checkout this twiddle link
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.