单选按钮验证在angular 2中无法正常工作。我尝试过,但是我不知道如何使用ng-model。任何人都可以解决此问题?
<div *ngIf="f.submitted && radio.invalid">
Please check any one
</div>
<form #f="ngForm">
<div *ngFor="let option of options">
<div class="radio">
<input type="radio"
name="radio"
id="radio-{{option.id}}"
[(ngModel)]="value"
[value]="option.value"
#radio="ngModel"
/>
<label for="radio-{{option.id}}">{{option.id}}
</label>
</div>
</div>
<button>Submit</button>
</form>