Friday, April 22, 2016

Angular 2 Radio Buttons

Until they fix checkboxes to use ngModel binding (here), this works pretty well:

<input type="radio" [checked]="selectedType=='first'" value="first" (click)="selectedType='first'"> First
<input type="radio" [checked]="selectedType=='second'" value="second" (click)="selectedType='second'"> second
{{selectedType}}

No comments:

Post a Comment