I love the reactive approach when working with material radio buttons. Below is an example of how to check for true and false with your database for a specific formControlName
Component within the Dialog Box
<mat-radio-group formControlName="trueClient">
<mat-radio-button class="material-radio" value="true" [checked]="data.trueClient === 'true'">True Client</mat-radio-button>
<mat-radio-button class="material-radio" value="false" [checked]="data.lostLead === 'false'">Lost Lead</mat-radio-button>
</mat-radio-group>
If this is an update form, make sure to set the values in your form builder. Example below:
.ts file for the component within the dialog box.
this.viewClient.setValue({
trueClient: this.data.trueClient
});
In this case i am opening the data within a dialog box. So the data is coming from the below:
component.ts prior that opens the dialog box. Just a reference so that you know where i got the data variable from above to set the values.
Component used to open the dialog box. Reference to Dialog in Materials docs for more info on how to setup.
const dialogRef = this.dialog.open(ClientNotesComponent, {
height: '600px',
width: '800px',
data: {trueClient: trueClient}
});
});
}