FormControl Asyncvalidator is called Multiple Times
My angular application consists of a single form whose input elements keeps changing on every next page(click).
Angular reactive form hasValidator return false for custom validator function
import { AbstractControl, ValidationErrors, ValidatorFn } from ‘@angular/forms’; export function trimValidator(minlength: number, maxlength: number): ValidatorFn { return ({ value }: AbstractControl): ValidationErrors | null => { const trimValue = value?.trim() || ”; if (trimValue.length < minlength) { return { minlength: true }; } else if (trimValue.length > maxlength) { return { minlength: true }; } […]
how to revalidate in angular reactive forms
I have a simple form like this:
Angular Phone Directive with Validator not working when copying
We are using Angular 17 along with Reactive forms in our project.
We have written a custom directive which formats the output to a us phone number format 111-222-3333
.
What we are seeing is that when someone tries to copy a number into the field – the field gets formatted, but the validator is still saying it is not valid.