when user clicks on div(class=unit) i want to target checkbox and mark it as checked/unchecked. also apply class unit-selected if checkbox is checked and remove class unit-selected if checkbox is unchecked.
i tried referring similar questions but nothing worked for me. can anyone help me to complete selectUnit($event)
<div class="unit" (click)="selectUnit($event)" [ngClass]="{'unit-selected'}">
<input type="checkbox" name="unit" />
<div class="unit-number">abc</div>
<div class="unit-desc">Description</div>
</div>
<div class="unit" (click)="selectUnit($event)" [ngClass]="{'unit-selected'}">
<input type="checkbox" name="unit" />
<div class="unit-number">xyz</div>
<div class="unit-desc">Description</div>
</div>
<div class="unit" (click)="selectUnit($event)" [ngClass]="{'unit-selected'}">
<input type="checkbox" name="unit" />
<div class="unit-number">mno</div>
<div class="unit-desc">Description</div>
</div>