Within my reactive form, I am iterating over some data and attempting to pre-set default values for radio buttons. While the default values are being successfully set, the validation is not functioning as expected.
<fieldset *ngIf="question.radioButtonList.length > 0">
<div class="choice-list">
<div *ngFor="let item of question.radioButtonList" class="choice-list-item">
<input type="radio" [name]="choice" formControlName="choice" [id]="item.id" [value]="item.id" [checked]="question.answer.selectedChoiceId === item.id"/>
<label>{{item.title}}</label>
</div>
</div>
</fieldset>
In the form definition, I have specified a required validator for the 'choice' form control.
'choice': new FormControl('', Validators.required)
Although the radio button appears correctly checked within the loop, the validator indicates that it is invalid until manually clicked by the user.