I am trying to set the background color of a div, when the checkbox next to it is checked.
The checkboxes are placed in their own div and the div I want to change the color is next to it.
I have a checkbox, which toggles all other checkboxes and if I toggle that checkbox, it toggles the color for all divs, but I want to have it individually as well for just the adjacent div.
This is what I have so far:
<div class="select-all-checkbox">
<input type="checkbox" name="all" checked [checked]="isAllSelected" (change)="isSelected = !isSelected">
</div>
<div class="grid" *ngFor="let item of items; let i = index;">
<div class="selection">
<input type="checkbox" [checked]="isSelected">
</div>
<div class="selected-div" [style.background-color]="isSelected ? '#00B7A8':'' ">
</div>
</div>
Aucun commentaire:
Enregistrer un commentaire