Reusable Validations 

In AngularJS


How to have validations without polluting your controllers


Abhik Mitra

Two way binding


  • ng-model
  • ng-change


( 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="" />

Parsers pipeline




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.




Thank You










Reusable validations in Angular JS

By Abhik Mitra

Reusable validations in Angular JS

How to properly validate your Angular JS

  • 1,012