December 2014
Intermediate to advanced
346 pages
6h 14m
English
With the addition of the validator pipeline, AngularJS's form validation is now highly extensible and straightforward to expand.
Formerly, custom form validation required messiness involving parsers and formatters; this is no longer the case. Custom validation can now be encapsulated cleanly within a directive.
The
ngModel directive now exposes the $validators property, which allows you to directly tap into its form validation.
The following directive definition is an example of a custom validator that ensures that a model value is not Packers:
(app.js) angular.module('myApp', []) .directive('validateFavoriteTeam', function() { return { require : 'ngModel', link : ...Read now
Unlock full access