2016-10-18 2 views
0

다음 코드를 수정하여 입력 요소 idEcho가 클릭되는 라디오 버튼의 값을 인쇄하고 현재 레이블 표시 대신 W1, W2, W3 및 W4에 대응한다. 그리고 나는 클릭 된 라디오 버튼에 의해 반환 된 값을 N1, N2, N3 및 N4로 지정합니다.각도 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">