通过使用此代码,我可以获得下拉列表ID(如果我评论ng-repeat
)
<tr @*ng-repeat="r in rvm"*@ @*>
<td>
<select ng-model="ID" ng-options="c.ID as c.Name for c in customer" ng-change="GetAccountBalance($index)" style="width:150px;height:22px;" name=" tCustomer">
<option value="">Select Customer</option>
</select>
</td>
</tr>
的javascript
$scope.GetAccountBalance = function (index) {
var getAccountBalance = ReceiptsService.GetAccountBalance($scope.ID);
var id = $scope.ID;
alert(id);
}
但我的要求是在下拉列表更改中添加新行
<tr ng-repeat="r in rvm">
<td>
<select ng-model="ID" ng-options="c.ID as c.Name for c in customer" ng-change="GetAccountBalance($index)" style="width:150px;height:22px;" name=" tCustomer">
<option value="">Select Customer</option>
</select>
</td>
</tr>
的javascript
$scope.rvm = [{}];
$scope.GetAccountBalance = function (index) {
if ($scope.rvm.length == (index + 1)) {
$scope.rvm.push({});
}
}
var getAccountBalance = ReceiptsService.GetAccountBalance($scope.ID);
var id = $scope.ID;
alert(id);
我是否可以使用此代码添加新行,但我没有选择id,
如何选择下拉列表ID?
如果我删除ng-repeat
我正在识别,