2016-10-18 7 views
0

次のコードを変更しようとしています。入力要素idEchoがクリックされているラジオボタンの値を表示し、現在のラベル表示の代わりにW1、W2、 W3およびW4に対応する。 と私は、クリックしたラジオボタンによって返される値をN1、N2、N3、N4にします。angle jsラジオボタンの表示と印刷

<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
<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"> 
関連する問題