如何获取data-id属性的值并将其作为showData()函数的参数传递?
<tr ng-repeat="schedule in schedules" ng-model="schedID" data-id="{{schedules.indexOf(schedule)}}">
<td>MON-THU</td>
<td>ACTIVITY CENTER</td>
<td>National Service Training Program 2 (MERGED)</td>
<td>0</td>
<td>
<input type="button" ng-click="showData()">
</td>
</tr>
&#13;
答案 0 :(得分:0)
使用$ index代替:
<tr ng-repeat="schedule in schedules" ng-model="schedID" data-id="{{schedules.indexOf(schedule)}}">
<td>MON-THU</td>
<td>ACTIVITY CENTER</td>
<td>National Service Training Program 2 (MERGED)</td>
<td>0</td>
<td>
<input type="button" ng-click="showData(schedules.indexOf(schedule))">
</td>
</tr>