I want to use radio button in a form using Angular 2
Options : <br/>
1 : <input name="options" ng-control="options" type="radio" value="1" [(ng-model)]="model.options" ><br/>
2 : <input name="options" ng-control="options" type="radio" value="2" [(ng-model)]="model.options" ><br/>
model.options initial value is 1
when the page is loaded the first radio button isn't checked and the modifications aren't binded to the model
Any Idea ?
use [value]="1" instead of value="1"
<input name="options" ng-control="options" type="radio" [value]="1" [(ngModel)]="model.options" ><br/>
<input name="options" ng-control="options" type="radio" [value]="2" [(ngModel)]="model.options" ><br/>
Edit:
As suggested by thllbrg "For angular 2.1+ use [(ngModel)]
instead of [(ng-model)]
"