angularjs中只显示选中的radio的值

angularjs中,只显示选中的radio的值。主要是相同的radio,name属性值要相同还有ng-model的值要相同,同时要指定value值。这样选中的时候就会在下面的div中显示选中的值了。

/*文件引用等省略*/
<
div class="showType">
   <label for="oneLine"><input type="radio" id="oneLine" name="showLine" ng-model="line" value="oneLine" />显示一列</label>
   <label for="twoLine"><input type="radio" id="twoLine" name="showLine" ng-model="line" value="twoLine"/> 显示两列</label>
   <label for="allOver"><input type="radio" id="allOver" name="showType" ng-model="type" value="allOver"/> 全屏展示</label>
    <label for="smallOver"><input type="radio" id="smallOver name="showType" ng-model="type" value="smallOver"/> 还原窗口</label>
 </div>

<div>
  {{line}}{{type}}
</div>

 

posted @ 2017-01-06 11:26  雨停了  阅读(3373)  评论(1编辑  收藏  举报