My angular app contains the mat-slide-toggle
functionality.
switchValue: {{ switch }} <br />
<mat-slide-toggle [checked]="switch" (toggleChange)="toggle()">Toggle me!</mat-slide-toggle>
</div>
This is how the component looks:
switch = false;
toggle() {
// backend request and heavy calculation performed here
this.switch = false;
}
Issue arises because the toggle does not update the switch
property. Even though the user toggles the switch from off
to on
, the switch
value remains false
. Is this expected behavior?