如何从html获取角度js中的选定单选按钮值 [英] How to get selected radio button values in angular js from html
本文介绍了如何从html获取角度js中的选定单选按钮值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hai ..
i有一个带有值和单选按钮的网格。我想在JS中获得所选的单选按钮值。现在我的id为undefined 。我可以将选中的单选按钮值保存到js并显示吗?请帮帮我
这是我的html
hai..
i have a grid with values and radio buttons.i want to get that selected radio button value in JS.now am getting my id as undefined.how can i save a selected radio button value in to js and display?please help me
this is my html
<tbody role="rowgroup">
<tr role="row" ng-repeat="dmd in data.InterruptibleandCurtailment" ng-class-even="'alt'">
<td class="tar fntm fntn leftcol" style="width: 312px;text-align:center"><input type="radio" value="dmd.InterruptedProcessId" ng-selected="SelectedRadio(dmd.InterruptedProcessId)" ng-model="dmd.InterruptedProcessId" /></td>
<td class="tar fntm fntn leftcol" style="width: 312px;text-align:center">{{dmd.InterruptionType}}</td>
<td class="tar fntm fntn leftcol" style="width: 312px;text-align:center">{{dmd.SiteName}}</td>
<td class="tar fntm fntn leftcol " style="width: 312px;text-align:center">{{dmd.TransmissionSystem}} </td>
我的js功能
my js function
function SelectedRadio(InterruptProcessId) {
var RadioFilter = [];
$scope.InterruptionandCurtailmentContainer.InterruptibleandCurtailment.forEach(function (gd) {
if (gd.InterruptedProcessId === InterruptProcessId)
RadioFilter.push(gd);
});
$scope.data.InterruptedandCurtailment = RadioFilter;
$scope.data.InterruptedProcessId = $scope.data.InterruptedandCurtailment[0].InterruptionProcessId;
$scope.data.InterruptedTypeId = $scope.data.InterruptedandCurtailment[0].InterruptionTypeId;
}
全部被宣布为*******
all are declared *******
推荐答案
scope.InterruptionandCurtailmentContainer.InterruptibleandCurtailment.forEach( function (gd){
if (gd.InterruptedProcessId === InterruptProcessId)
RadioFilter.push(gd);
});
scope.InterruptionandCurtailmentContainer.InterruptibleandCurtailment.forEach(function (gd) { if (gd.InterruptedProcessId === InterruptProcessId) RadioFilter.push(gd); });
scope.data.InterruptedandCurtailment = RadioFilter;
scope.data.InterruptedandCurtailment = RadioFilter;
scope.data.InterruptedProcessId =
scope.data.InterruptedProcessId =
这篇关于如何从html获取角度js中的选定单选按钮值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文