Reputation: 29097
I have a radio group and I would like to initially have one checked
this.form = new FormGroup({
'test': new FormControl('AAA')
});
And the corresponding HTML
<form [formGroup]="form">
<input name="test" type="radio" value="AAA" formControllName="test"> AAA
<input name="test" type="radio" value="AAA" formControllName="test"> BBB
</form>
I've initialized the fromControl with a value of AAA
, but it doesn't check the first radio button. Any suggestions what is I do wrong here?
Upvotes: 0
Views: 209
Reputation: 27293
You have sytax error. It's should be formControlName
<form [formGroup]="form">
<input name="test" type="radio" value="AAA" formControlName="test"> AAA
<br>
<input name="test" type="radio" value="AAA" formControlName="test"> BBB
</form>
Upvotes: 4