5

I have a form that contains an input of type email that is required. I would like to have my own custom validation on that input field in order to be able to show the error message in different languages. However, currently the input field is evaluated by the HTML5 validation.

The code looks like this:

<input [(ngModel)]="user.email" type="email" class="form-control" id="email" name="email" required placeholder="{{'Email'|translate}}">

Is it possible to disable that, so that I am able to implement my own validation?

The validation code is yet to be written.

3
  • 4
    Include <form> tag with no validate attribute Commented Jan 17, 2017 at 7:13
  • import only { FormGroup, FormBuilder} from '@angular/forms'; Commented Jan 17, 2017 at 7:19
  • @Aravind thanks, I will accept it as correct answer if you want to post it. Commented Jan 17, 2017 at 7:27

1 Answer 1

8

Include tag with no validate attribute as below

<form action="Form" novalidate>
  <input [(ngModel)]="user.email" type="email" class="form-control" id="email" name="email" required placeholder="{{'Email'|translate}}">
  <input type="submit">
</form>
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.