CHApTer 6 ■ WorkIng WITH ForMS
This revision means that our input[name='email'].ng-dirty.ng-valid rule kicks in. Consequently, the text
becomes green. This is quite a powerful technique, because once you know which classes AngularJS is adding
and when, you can use these classes as hooks for just about anything you like. Of course, just because you can
doesn’t mean that you should! There was a little bit of legwork involved in building the validation and validation
feedback code into our registration form, but it wasn’t overly complicated. This has been a relatively long chapter,
and I recommend that you load up this code in your web browser and favorite IDE; it is well worth doing some
experimentation with it. The finished version can be found in Listing 6-19 and Listing 6-20. Admittedly, the validation
rules that we studied here were fairly basic, but the general approach we used can take you quite far.
Listing 6-19. Registration Form—the HTML Code
Thank you for taking the time to register!