I have a table with columns and I need to calculate values in other cells when there is a change event on the table. I want to use ng-change so that the changes are seen immediately. However, I am unsure of how to properly utilize ng-model - if it is used in one row, it affects all rows, causing each row to be recalculated, which is not the intended outcome. I only want to update one row at a time.
Angular requires ng-model when using ng-change. How can I correctly implement ng-change with multiple rows in a table?
I know I can achieve this using jQuery's onchange event, but since I already have a controller in HTML, I would prefer to handle everything in Angular.
Here is an example of one of the rows:
<tr class="jtable-data-row jtable-row-even"
data-record-key="110000001"><td>110000001</td>
<td><input type="text"
ng-change="RecalculateValues($event);" ng-model="Quantity" value="1"></td>
<td><input type="text"
ng-change="RecalculateValues($event);" ng-model="Bruto" value="7.15"></td>
<td><input type="text"
ng-change="RecalculateValues($event);" ng-model="Neto" class="cellContent" class="cellContent" value="17"></td>
</tr>
EDIT:
Plunker here demonstrates my issue - even though the ng-change event is connected to the input values, the cells are not updating as expected.