Reusable Validations
In AngularJS
How to have validations without polluting your controllers
Abhik Mitra
Two way binding
( The JQuery way of doing - in Angular)
Validations Continued..
<
input
type="text"
ng-model
="item"
ng-change
="itemChanged()"/>

Angular Directives
A directive that validates the model
<input type="text" ng-model="item" should-be-display-name="" />
Advantages
-
Controllers remain simple and maintainable
- Models always contain valid data .
- Functions using ng-model do not need need to check for validity
- Validations are re-usable across.