Hi,
i have one filed in paytypes array
i need to display sum of that fiels values on below of row
<div class="table-responsive " scroll-bookmark="bookmark2">
<table id="tblOrders" cellpadding="12" class="table table-bordered table-hover table-striped"
style="margin-left: 20px; margin-right: 20px;">
<tr class="success">
<th>PayType</th>
<th>Is %</th>
</tr>
<tbody ng-repeat="detail in paytypes">
<tr ng-if="detail.PTI_Name=='Allowance'">
<td><input type="text" ng-model="detail.PDI_Name" /></td>
<td><input type="text" ng-model="detail.amount" /></td>
</tr>
</tbody>
<tfoot>
<tr>
<td>Total : </td>
<td>
<input type="text" value="total()" ng-model="total()" class="form-control input-sm" readonly />
</td>
</tr>
</tfoot>
</table>
</div>
//total
$scope.total = function () {
var total = 0;
angular.forEach($scope.paytypes, function (detail) {
total += detail.amount;
})
return total;
}
Total value is not displaying properly
could you please check it and help me