O'Reilly logo

Rails, Angular, Postgres, and Bootstrap by David B. Copeland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Validating User Input with Angular Forms

In addition to the properties of a binding we discussed earlier, Angular provides sophisticated features to interact with form data.[82] We can use these features to implement various validations on our input fields using HTML5’s validations. For example, we can indicate a field is required using required like so:

 <input type=​"text"​ name=​"first_name"​ required>

HTML5 validations, and thus Angular’s form validations, can do more than just require values. Here are the validations we’re going to implement, and it won’t require very much code to make them work:

  • First name, last name, and username are required.
  • Email is required and should look like an email address.
  • Address and city are required. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required