0

I tried to use angular form to validate user's input in a "ionic generated component" but error as mentioned in the title kept occurring.

Angular forms and validations used in "ionic generated pages" are working fine.

Any ideas?

Picture of :

HTML Component

Error

TypeScript Component

2 Answers 2

1

I managed to fix this by using the solution here https://stackoverflow.com/a/57251807/9516387

Which is:

You checking for the presence of an error where no error might exist.

You want something like this:

f.email.errors?.required

Or even:

f.email?.errors?.required

Do the same for the password field and anywhere else where the property might not exist when it is first called.

Sign up to request clarification or add additional context in comments.

Comments

0

You should try to access it by f.controls.recipientName.errors

1 Comment

Thanks for the reply but it still couldn't fix the problem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.