<table class="table table-striped table-hover" style="font-size: 13px"> <thead> <tr> <th style="width:15%">贷款明细</th> <th style="width:15%">贷款类型</th> <th style="width:15%">贷款金额(元)</th> <th style="width:15%">贷款余额(元)</th> <th style="width:15%">贷款期限</th> <th style="width:15%">月供(元)</th> <th style="width:10%">操作</th> </tr> </thead> <tbody> <tr ng-repeat="item in unclearedLoanSummary"> <td> <input type="text" class="form-control" id ='loanDetail' ng-maxlength="32" ng-model="item.loanDetail" required> </td> <td> <input type="text" class="form-control" id ='loanType' ng-maxlength="32" ng-model="item.loanType" required> </td> <td> <input type="number" step="0.1" class="form-control" id ='loanAmount' ng-maxlength="12" ng-model="item.loanAmount" required> </td> <td> <input type="number" step="0.1" class="form-control" id ='loanBalance' ng-maxlength="12" ng-model="item.loanBalance" required> </td> <td> <input type="number" class="form-control" id ='loanPeriod' ng-maxlength="5" ng-model="item.loanPeriod" required> </td> <td> <input type="number" step="0.1" class="form-control" id ='monthRent' ng-maxlength="12" ng-model="item.monthRent" required> </td> <td> <button class="btn btn-danger btn-sm" type="button" ng-click="deleteUnclearedLoanSummaryRow($index)"><i class="fa fa-times m-r-sm"></i>删除</button> </td> </tr> </tbody> </table>
service中监听: var watchMonthRent = $scope.$watch('{a:unclearedLoanSummary,b:externalGuaranteeSummary,c:activatedCreditcardSummary}',function(newVal,oldVal){ var sum=0; if(newVal!=oldVal){ var arr=newVal.a.concat(newVal.b).concat(newVal.c); for(var k=0;k<arr.length;k++){ var item=arr[k]; sum+=item.monthRent; } $scope.customCreditSummary.monthRentTotalAmount=sum; } },true);