O'Reilly logo

Mastering Web Application Development with AngularJS by Pawel Kozlowski, Peter Bacon Darwin

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 AngularJS forms

In this section we explain how to use validation directives and how they work with ngFormController to provide a full validation framework.

Understanding ngFormController

Each form (or ngForm) directive creates an instance of ngFormController. The ngFormController object manages whether the form is valid or invalid and whether it is pristine or dirty. Importantly, it works with ngModelController to track each ngModel field within the form.

When an ngModelController is created, it registers itself with the first ngFormController it comes across as it traverses up its list of parent elements. This way, the ngFormController knows what input directives it should track. It can check whether these fields are valid/invalid or ...

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