2

I have a form with an email field. I would like to prevent the user from submitting unless the email address exists and is valid. However, I only want these errors to appear when toggling out of the email field or clicking sumbit. My "invalid email" message is appearing WHILE the user is typing the email and remains visible until they've finished entering a valid email. How can I prevent this behavior?

        <div ng-show="emailMeForm.Email.$error.required" class="errorMessage">
            You must enter an email
        </div>

        <div ng-show="emailMeForm.Email.$error.email" class="errorMessage">
            Email address invalid
        </div>

        <form name="emailMeForm" novalidate="">
            Email Address
            <input ng-model="vm.emailAddress" type="email" name="Email" />
            <button ng-click="emailMeForm.$valid">Continue</button>
        </form>

1 Answer 1

1

Must be sufficient:

ng-show="emailMeForm.Email.$touched && emailMeForm.Email.$error.required"
Sign up to request clarification or add additional context in comments.

Comments

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.