I have a radio group that I want to set the value of from my component code. However I cannot seem to set the initial value using [(ngModel)]. I don't get any errors or anything to show why it is not showing the radio button selected.
<div class="form-group">
<mat-radio-group [(ngModel)]="selectedStatus" formControlName="completed">
<mat-radio-button [value]="1">Call Complete</mat-radio-button>
<mat-radio-button [value]="2">Call Incomplete</mat-radio-button>
</mat-radio-group>
</div>
Component code snippets:
selectedStatus: Array<string>;
private initForm() {
this.eventEditForm = new FormGroup({
'completed': new FormControl()
});
this.selectedStatus = this.data[0].completed;
}
this.data[0].completed returns 1 or 2 from a data service.