I followed the following tutorial for adding two values in Angular; Addition of Two Numbers in AngularJS
But now I have to sum dynamic text box values inside ng-repeat.
I have the following Code
HTML Code
......
<table>
<tr>
<th>Name</th>
<th>Days</th>
</tr>
<tr ng-repeat="si in serImp">
<td>{{si.Name}}</td>
<td><input type="number" ng-model="si.Days" /></td>
</tr>
</table>
.......
<button ng-click="sum()">Calculate</button>
.......
JS code
.........
$scope.serImp = [];
$scope.serImp = data;
// here data is object contain multiple Name+Durations e.g.
/*data =
[0]
Name:"first"
Days: 1
[1]
Name:"second"
Days: 2
[2]
Name:"third"
Days: 3*/
$scope.sum = function () {
// sum code goes here
}
........
My Question is : How can I get the sum of the values/numbers from the ng-model="si.Days"