This is the HTML code I have for a mat-slide-toggle element, with a toggleStatus() function:
<span class="form-control form-control-plaintext">
<mat-slide-toggle name="status" checked=""
formControlName="status" #status>
<label *ngIf="!formGroup.get('status').value" (click)="toggleStatus(status)" style="margin: 0">Status: Disabled</label>
<label *ngIf="formGroup.get('status').value" (click)="toggleStatus(status)" style="margin: 0">Status: Active</label>
</mat-slide-toggle>
</span>
The toggleStatus() function simply toggles the status of the visual checkbox. However, it does not change the form control value when clicking on the label.
So, how can I make the form control value update when I click on the label?