I have the following piece of code in my HTML page, with a very standard controller.
<table class="table table-striped">
<tr>
<th>Item ID</th>
<th>1st Value</th>
<th>2nd Value</th>
</tr>
<tr ng-repeat="(id, values) in myItemList">
<td> <input type="checkbox" ng-model="selected[id]"> {{id}}</td>
<td> <input type="number" ng-model="values.first"></td>
<td> <input type="number" ng-model="values.second"></td>
</tr>
</table>
In the above code an item is selected only when the checkbox is clicked. However, I would like that when the user clicks on either of the two numerical input fields of any particular row, the associated checkbox is checked.
I have not found anywhere a similar problem. Usually the problem that developer face is to make something happen when a checkbox is checked. However, this case is different.
I don't know how AngularJS can help me with this problem, considering that the rows are displayed through in a ng-repeat
loop. Any suggestion?
Aucun commentaire:
Enregistrer un commentaire