如何将这种验证从由动态控件驱动的模板转换为反应形式?
<form useIndexedField [indexedFields]="indexedFieldKeys" autofocus [focusReset]="resetAutoFocus" (ngSubmit)="Get()" #searchForm="ngForm">
<div *ngFor="let item of userPrefs">
<div *ngIf="item.controlType === 'textbox'">
<input-question [(ngModel)]="item.value" #iq="ngModel" [errorMessage]="iq.errors && iq.errors.pattern && item.dataType === 'int' ? 'Only numbers are allowed for this field' : ''"
[pattern]="item.dataType === 'int' ? '^[0-9]+$' : '.*'" placeholder="{{item.placeholderText}}" label="{{item.label}}"
name="{{item.key}}" maxlength="{{item.maxlength}}" id="{{item.key}}">
</input-question>
</div>
</div>
</form>