【问题标题】:angular js radio buttons display and printangular js单选按钮显示和打印
【发布时间】: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


    【解决方案1】:
    <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">
    

    【讨论】:

      猜你喜欢
      • 2020-10-03
      • 1970-01-01
      • 1970-01-01
      • 2019-12-14
      • 2018-04-21
      • 2021-06-02
      • 2018-03-06
      • 2013-06-05
      • 2015-07-03
      相关资源
      最近更新 更多