给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; }