Thanks,

Please make sure that you have wrote the formControlName correctly and if you are sure that the object refrence you are passing to 'mat-error' is not null but the error consist, you can use the following syntax to tell Angular that you are aware of it and it is not null:

registerForm.get('email')!.hasError('required')

mind the ! after form.get()

Hossein Mousavi
Hossein Mousavi

Written by Hossein Mousavi

Senior Software Engineer @AIHR 🇳🇱 hossein.dev

Responses (1)