Answer the question
In order to leave comments, you need to log in
How to validate all Angular form fields?
I am using template driven form:
<form #documentForm="ngForm" autocomplete="off">
<mat-form-field>
<mat-label>{{ fieldDefinition.title }}</mat-label>
<input
matInput
type="text"
name="{{ elementName }}"
#ref="ngModel"
[required]="fieldDefinition.isrequired"
[pattern]="fieldDefinition.mask"
[(ngModel)]="fieldDefinition.value"
/>
<mat-error *ngIf="ref.touched && ref.invalid">
{{ fieldDefinition.maskdef }}
</mat-error>
</mat-form-field>
</form>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question