表单自定义字段验证角度 2 [英] Form custom fields validation angular 2
问题描述
我尝试对选择和单选按钮和复选框进行表单模板驱动的验证,但无法使用这些自定义字段.我们如何验证这些字段.我不知道该怎么做.请任何人帮我解决这个问题.
<div class="form-group"><label for="country">国家</label><app-selectbox name="country" [(inputModel)]="model.country" [(ngModel)]="model.country" #country="ngModel" required><option [ngValue]="null">---选择---</option><option *ngFor="let item of stateData" [value]="item">{{物品}}</选项></app-selectbox>
<!-- 主持无线电检查--><div class="form-group"><label class="col-md-4 control-label">你有吗托管?</label><div class="col-md-4"><div class="radio"><标签><app-radiobtn type="radio" name="hosting" value="yes" [(ngModel)]="model.hosting" required #hosting="ngModel" [(inputModel)]="model.hosting">是</app-radiobtn>标签>
<div class="radio"><标签><app-radiobtn type="radio" name="hosting" value="no"[(ngModel)]="model.hosting" required #hosting="ngModel" [(inputModel)]="model.hosting">否</app-radiobtn>标签>