2021年1月20日星期三

Angular - form validators don't work on initial load

I need the error to show up on the initial load. Instead it only shows after typing something in the textarea. How do I force the validators error to appear on the initial load indicating that text is required?

HTML:

<epc-textarea class="half spaced-content" label="Description" formControlName="description" [maxlength]="descLength">       <div class="error" *ngIf="_description.errors?.required" required></div>  </epc-textarea>  

TS:

description: ['', [Validators.required]]  
https://stackoverflow.com/questions/65818230/angular-form-validators-dont-work-on-initial-load January 21, 2021 at 05:53AM

没有评论:

发表评论