当单击按钮时,我想更改颜色,当单击同一按钮时,我想返回到原始颜色。现在,当单击按钮时,所有行都会改变颜色。
html
<table>
<tbody ng-repeat="field in availableFields">
<tr ng-class="{'orderTypeTableRowSelected':tableRowTrueOrFalse}">
<td style="padding:3px;">{{field.name}}</td>
<td style="padding:3px;">
<button type="button" ng-click="orderTypeTableRowSelected(field)" class="btn btn-danger" style="margin-left:10px;"><i class="fas fa-check"></i> Required</button>
<button type="button" class="btn btn-warning"><i class="fas fa-check"></i> Default </button>
</td>
</tr>
</tbody>
</table>
CSS
<style>
.orderTypeTableRowSelected {
background-color: #E0F7FA;
}
</style>
有角的
$scope.tableRowTrueOrFalse = false;
$scope.orderTypeTableRowSelected = function (field) {
$scope.tableRowTrueOrFalse = !$scope.tableRowTrueOrFalse;
console.log(field);
};
慕神8447489
相关分类