我正在尝试使用ng-model设置值(通过函数传递值)。
我的代码看起来像
输入标签:
<input name="comments" ng-model="comments" class="form-control" type="text">
网格表:
<tr ng-repeat="value in values">
<td><input type="radio" ng-click="callvalues(value.CUSTID);"></td>
Angularjs代码:
$scope.callvalues = function($scope,custID){
alert("custID");
};
我正在获取custID未定义。我试图使价值观坚不可摧
$scope.callvalues = function($scope,custID){
$scope.comments = "122";
};
控制台中没有错误,但也无法正常工作。
最佳答案
如果您的意思是单击单选按钮和警报值,则可以尝试以下代码
$scope.callvalues = function(custID){
alert(custID);
$scope.comments = custID;
};
nk
https://plnkr.co/edit/CYi3e2D0xLkWksr9p4y8?p=preview