How can I check/uncheck a checkbox programmatically.
<input type="checkbox" formControlName="checkedGender" [checked]="checkedGender" (change)="checkedGender = !checkedGender" disabled />
I have this below angular code but its not able to check/uncheck.
Angular line of code for checking the checkbox:
this.formGroup.controls['checkedGender'].setValue(true);
Similarly Angular line of code for unchecking the checkbox
this.formGroup.controls['checkedGender'].setValue(false);
but none of those are showing any effect on checkbox, am I doing something wrong?