Just switched from Angular2 (where my code worked with no problem) to Angular4.
I have a true
value bound to one of my radio buttons, but the radio button is not selected when the view renders.
Condensed version of code shown below:
My component:
// all relevant imports...
...
export class My Component{
public form: FormGroup = this.formBuilder.group({ prop1: ''});
constructor(private formBuilder: FormBuilder){
this.form.patchValue({prop1: true});
}
}
view:
<form [formGroup]="form">
<input type="radio" class="form-control" formControlName="prop1" [value]="true"/>
<input type="radio" class="form-control" formControlName="prop1" [value]="false"/>
</form>