angularjs 点击行选中radio单选按钮

给input单选框添加value值和ng-model绑定,保证value属性值和绑定的值一致自然就能选中

 

HTML代码

<table ng-table="tableParams" class="table ng-table-responsive">
    <thead class="tableThead">
    <th><input type="radio" disabled></th>
    <th>版本号</th>
    <th>临时版本号</th>
    <th>创建人</th>
    <th>创建时间</th>
    </thead>
    <tbody>
    <tr ng-repeat="item in historyMsg" class="tableTdV" ng-click="rowClick(item.ID)" ng-class='{focus: item.ID==focus}'>
        <th><input type="radio" name="radioType" id="{{item.ID}}" value="{{item.ID}}" ng-model="focus"></th>
        <td>
            {{item.VersionNumber}}
        </td>
        <td>
            {{item.TempVersionNumber}}

        </td>
        <td>
            {{item.Creators}}

        </td>
        <td>
            {{item.CreateDate}}

        </td>
    </tr>
    </tbody>
    <tfoot>
    <tr >
        <td class="text-success text-right" colspan="12"><strong>共{{tableParams.total()}}条记录,共 {{totalPages}}页</strong></td>
    </tr>
    <tr>
        <td class="text-success text-center" colspan="12">
            <button type="submit" class="btn alertBtn" ng-click="delete()" style="margin-left: 30px;width: 100px;">删除</button>
            <button type="submit" class="btn alertBtn" ng-click="Closed();" style="width: 100px;">确定</button>
        </td>
    </tr>
    </tfoot>
</table>

 

JS 代码

//点击选中行
$scope.rowClick = function (id) {
    $scope.focus = id;

}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值