I'm trying to connect a checkbox's boolean value to a table's class.
so, if checkbox is checked => enable dark mode.
I've tried the following:
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet" />
<table class="table table-striped" [ngClass]="{'table-dark': darkMode == 'true'}">
<thead class="thead-light">
<tr>
<th scope="col">1</th>
<th scope="col">2</th>
<th scope="col">3</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
</tbody>
</table>
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" [checked]="darkMode" ([ngModel])="darkMode=(darkMode ? false : true)" id="customSwitch">
<label class="custom-control-label" for="customSwitch">Toggle Dark Mode</label>
</div>
How can i tie a boolean value from a checkbox to an inline-angular variable and apply a css-class?