【发布时间】:2017-02-28 08:11:42
【问题描述】:
我正在尝试修改以下代码,以便输入元素 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 设置 谢谢
【问题讨论】:
标签: javascript angularjs data-binding radio-button