試圖禁用表中的按鈕。並啓用它,只有當選定的項目/點擊/激活如何禁用按鈕點擊直到選擇/激活項目?
按鈕代碼
<td><a class="btn btn-info" ng-disabled="isDisabled">Edit</a></td>
禁用布爾 $scope.isDisabled = false;
試圖啓用按鈕選擇才爲真
$scope.selectedRow = false; // initialize our variable to null
$scope.setClickedRow = function(index) { //function that sets the value of selectedRow to current index
$scope.selectedRow = index;
$scope.isDisabled = true;
}
任何幫助請? http://plnkr.co/edit/llmcbXCA93kuTVTzpQlm?p=catalogue
全表
<thead>
<tr>
<th class="hidden-xs">ID</th>
<th>Name</th>
<th>Date</th>
<th>Grade</th>
<th>Subject</th>
<th></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="trainee in trainees | filter: search" ng-class="{'selected':$index == selectedRow}" ng-click="setClickedRow($index)">
<td class="hidden-xs">{{$index+1}}</td>
<td>{{trainee.name}}</td>
<td>{{trainee.date | date:'d/M/yyyy'}}</td>
<td>{{trainee.grade}}</td>
<td>{{trainee.subject}}</td>
<td><a class="btn btn-info">Edit</a></td>
</tr>
</tbody>
</table>
顯示完整的表 –
http://plnkr.co/edit/llmcbXCA93kuTVTzpQlm?p=catalogue – torresito
http://plnkr.co/edit/c7UC9mfdJIMHF8ctq5ft?p=preview –