【发布时间】:2016-06-15 17:55:12
【问题描述】:
我有一个表格,表格的第一列是单选按钮。我使用 ng-repeat 创建了。单击时,我必须访问选中的单选按钮值,问题是我无法访问该值。
<div class="panel-heading">
<h3 class="panel-title mainPanelTitle">Future Appointments</h3>
</div>
<div class="panel-body">
<div class="table-responsive noSwipe tableContainer" tasty-table bind-resource="futureAppointmentsMap" bind-filters="filters">
<div class="col-sm-3 tableSearch">
<input type="text" class="form-control input-sm"
placeholder="Search" ng-model="filters" value=""/>
</div>
<table id="tblPatientMyAppointmentsFuture" class="table table-bordered">
<thead tasty-thead bind-not-sort-by="notSortBy"></thead>
<tbody>
<tr ng-repeat="appointment in rows">
<td>
<label class="radio-inline">
<input type="radio" name="rbnTagAppointment" value="{{appointment.id}}" ng-model="selectedAppointmentId">
</label>
</td>
<td ng-class="{{appointment.timeLineId!=0?'tdImage':''}}" data-title="No">
{{$index+1}}
<img ng-if="appointment.timeLineId!=0" ng-src="img/brightfuture_logomedium.png"/>
</td>
<td data-title="Time">
{{changeDateFormat(appointment.date)}}<br>
{{appointment.time}}
</td>
<td data-title="Specialty">
{{appointment.specialtyId=="5"?'Pediatrics':appointment.specialty}}
</td>
<td data-title="Physician">
{{appointment.physicianName}}<br/>
{{appointment.orgName}}
</td>
</tr>
</tbody>
</table>
<div tasty-pagination ng-show="rows.length>0"></div>
<div class="divNoData" ng-show="rows.length==0">
No data available
</div>
<div class="text-center">
<button class="btn btn-default btn-sm" ng-click="tabAppointmentWithImmunization()">Upload</button>
</div>
</div>
</div>
在我的控制器中。
$scope.tabAppointmentWithImmunization = function() {
console.info($scope.selectedAppointmentId);
};
当我打印它显示未定义的值时。
【问题讨论】:
-
我修复了你的 html,你有很多不需要的结束标签(为什么?),你可能想复制它。
-
@MartijnWelker 抱歉,这是复制粘贴问题...
标签: jquery angularjs radio-button