I have a table like this:
<tr class="data-row" ng-repeat="item in model.Invoice.InvoiceItemData">
<td>
<input type="text" name="itemServiceTitle" ng-model="item.ServiceTitle" />
</td>
<td>
<input type="text" name="itemQuantity" ng-model="item.Quantity"/>
</td>
<td>
<input type="text" name="itemPricePerDimension" ng-model="item.PricePerDimension" />
</td>
<td>
<input type="text" name="itemDeliveryCost" ng-model="item.DeliveryCost" readonly="readonly" />
</td> ...
and I need to calculate each itemDeliveryCost by formula
item.DeliveryCost = item.Quantity * item.PricePerDimension
Question is - what is the best approach to do this? Notice that cahges for item.Quantity and item.PricePerDimension must be reflected in item.DeliveryCost dynamically.
Inside your api success call you can do following
You will get calculated values in view..
If you want to change values after getting data, then above approach won't work but for that you need to call a method on value change of quantity and dimention like following