Join Ray Villalobos for an in-depth discussion in this video What we're building, part of AngularJS 1: Form Validation.
- View Offline
- In this project, we're going to add dynamic validation to an existing form using angularJS. So for example, if I come right here into this first field and I type in a proper value, and I hit tab, that field is going to highlight in green to give me some visual feedback and let me know that I have filled out that field properly. If I try to just go past this second field, which is a required field, it's going to give me some feedback saying that you have to fill out your last name.
Notice that as soon as I type something in here, both of those will go away. Now in this instance, if I don't type something that is a valid email, then it's going to do the same thing, just show me a message right here. As soon as I type something that is a proper email address, it's going to work just fine. This last field is going to check to make sure that I have at least six characters. Once I fill out the form correctly, I can hit the submit button, and it's just going to give me a short message right here to let me know that I've done everything correctly.
Angular, however, is going to make it surprisingly easy to do. In the rest of this course, I'm going to show you how.