mercredi 26 août 2020

Unit Test of FormControl in Angular 9: TypeError: Cannot read property 'validate' of null (Validators.compose)

I always get the error TypeError: Cannot read property 'validate' of null with Validators.compose when trying to test the below code

this.form.controls.phoneNumber.setValidators([
Validators.compose([this.utilsService.conditionalRequired(isRequired)]), Validators.pattern(Regex[regexKey])
]);

any idea how can I (Validators.compose) part?

Aucun commentaire:

Enregistrer un commentaire