I can make my mat-checkbox
disabled, but want to maintain the same css that it has when being enabled. The checkbox will be checked when its input text has a value, like I did here below:
<mat-checkbox [disableRipple]="true" [checked]="option.controls.text.value !== ''">
<input #infoBox matInput formControlName="info" class="input-other" maxlength="100" type="text" [value]="option.controls.text.value">
</mat-checkbox>
If I understand correctly, the user should never be able to toggle the checkbox manually. Instead it will be toggle programmatically depending on the input value.
You can very simply prevent the default click
behavior, so nothing happens when the checkbox is clicked:
<mat-checkbox [checked]="infoBox.value !== ''"
[disableRipple]="true"
(click)="$event.preventDefault()">
<input #infoBox matInput type="text">
</mat-checkbox>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With