我尝试过但不起作用如何在angular 2中验证单选按钮以及复选框和邮政编码。任何人都可以找到解决方案。请帮助我解决此问题。 演示:https://stackblitz.com/edit/angular-7-template-driven-form-validation-ndspdl?file=app/app.component.html
<div class="form-group">
Radio Buttons:
<div *ngFor="let enum of enum_details">
<label for="enum_answer_{{enum.name}}">
<input id="enum_answer_{{enum.name}}" [value]='enum.name' type="radio"
name="enums" enums="ngModel" [(ngModel)]="radioSelected">
{{enum.name}}
</label>
</div>
</div>
<div class="form-group">
Checkboxes:
<div *ngFor="let item of items; let i = index" class="checkbox">
<label for="{{item.id}}">
<input type="checkbox" value="{{item.id}}" required id="
{{item.id}}" #chk="ngModel" [(ngModel)]="item.isSelected"
name="name+str(i)" (change)="CheckBoxChanged(i,$event)" />
<span class="text-body">{{item.name}}</span>
</label>
</div>
</div>