简体   繁体   English

单选按钮不起作用-AngularJS

[英]Radio Button not working - AngularJS

Hi Am using angularJS in my project. 嗨,我在我的项目中使用angularJS。 But when tried to add a span to one of my input field, all the radio buttons related to that became non-functioning. 但是,当尝试在我的输入字段之一中添加跨度时,与此相关的所有单选按钮均无法正常工作。 Can someone suggest me what's wrong here. 有人可以告诉我这是怎么回事。

<tr ng-repeat="(k,v) in final_data.checks">
    <td>
        <div class="input-group input-group-lg" style="width:350%">
            <span class="input-group-addon">Check{{ k+ 1 }}</span>

            <input type="text" ng-model="v.check_name" class="form-control" placeholder="Add Check here">
        </div>
    </td>
    <!--<---->

    <td align="center">
        <br>&nbsp;&nbsp;&nbsp;
        <input type="radio" ng-model="v.category" name="{{ k }}" value="A">
    </td>
    <td align="center">
        <br>&nbsp;&nbsp;&nbsp;
        <input type="radio" ng-model="v.category" name="{{ k }}" value="B">
    </td>
    <td align="center">
        <br>&nbsp;&nbsp;&nbsp;
        <input type="radio" ng-model="v.category" name="{{ k }}" value="C">
    </td>
    <!--<button ng-click="clear()">Clear</button>-->

    <!--&ndash;&gt;-->
    <td>
        <br/>
        <a href="" ng-click="clear($index)">
            <i class="glyphicon glyphicon-trash"></i>
        </a>
    </td>
</tr>

You are adding your new radio button out side the radio button group. 您正在将新的单选按钮添加到单选按钮组之外。 so when you add the new radio button the newly added button works but due to that it will affect your existing radio button. 因此,当您添加新的单选按钮时,新添加的按钮可以使用,但是由于该操作会影响您现有的单选按钮。

The div is actually affecting all parts here, because i type in something weird like 350%. div实际上会影响此处的所有部分,因为我键入了类似350%的内容。 I removed that part and added <input type="text" ng-model="v.check_name" class="form-control" placeholder="Add Check here" style="width:100%"> instead. 我删除了该部分,并添加了<input type="text" ng-model="v.check_name" class="form-control" placeholder="Add Check here" style="width:100%"> Now its working. 现在可以正常工作了。 Thanks Rajan 谢谢拉詹

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM