我正在尝试修改以下代码,因此输入元素idEcho打印被单击的单选按钮的值,而不是当前标签显示,我想相应地显示W1,W2,W3和W4。 我希望点击的单选按钮返回的值为N1,N2,N3和N4。
<body>
<label ng‐repeat="w in radioDetails">
{{w.what}}:
<input type="radio" ng‐model="$parent.mSelection" value={{w.what}}><br>
</label>
<input id="idEcho" type="text">
<script>
myModule=angular.module("appEX",[]);
myModule.controller("ctrl", function($scope){
$scope.mSelection="a1";
$scope.radioDetails=[
{what:"a1",yes:"W1",no:"N1"},
{what:"a2",yes:"W2",no:"N2"},
{what:"a3",yes:"W3",no:"N3"},
{what:"a4",yes:"W4",no:"N4"}
];
});
</script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
</body>
所有假设正确的角度js设置 感谢
答案 0 :(得分:0)
<label ng‐repeat="w in radioDetails">
{{w.yes}}:
<input type="radio" ng‐model="$parent.mSelection" value={{w.no}}><br>
</label>
<input id="idEcho" type="text" ng‐model="$parent.mSelection">