angular/angular.js — pull request #2897 by Pasvaz (2013-06-07 03:45:18+00:00)
Title: feat(ngValidityChange): create new directive ngValidityChange

ngValidityChange evaluates given expression when model validity changes.

At the moment form validation is mostly done binding the $viewValue via ngChange, checking the model, or binding some events (blur, change) on the DOM element. Those approaches might fail if the validity is set without changing the model, like by a custom directive that update asynchronously the validity.

I made a demo to show how ngChange fail in this use case: http://plnkr.co/edit/8NilSQDuxCz1YvxT78Ip?p=preview

ngValidityChange directive makes form validation very easy allowing developers to be notified on the fly when something happens to the form values.