AngularJS 1.2.x (for angular-validation 1.2.x)

AngularJS 1.3.x (for angular-validation 1.3.x)


Install with npm

npm install angular-validation 

Or with Bower

bower install angular-validation 

Files to download

Add the files to your html

<script src="dist/angular-validation.js"></script>
<script src="dist/angular-validation-rule.js"></script>

If you are using Bower:

<script src="lib/angular-validation/dist/angular-validation.js"></script>
<script src="lib/angular-validation/dist/angular-validation-rule.js"></script>
angular.module('yourApp', ['validation']);

Including your validation rule

angular.module('yourApp', ['validation', 'validation.rule']);

Writing your first code

<form name="Form">
        <div class="row">
                <input type="text" name="required" ng-model="form.required" validator="required"></div>
                    <input type="text" name="url" ng-model="form.url" validator="required, url">
                <button validation-submit="Form" ng-click="next()">Submit</button>
                <button validation-reset="Form">Reset</button>

You can style different states of your form elements using the following selectors

Invalid Selectors { /* Your style here */ }
Valid Selectors { /* Your style here */ }

You can also include your vendor libraries classes in you are using CSS preprocessors such as LESS or SASS.

Using Bootstrap classes { .has-error .form-control; }

For more on AngularJS validation classes check at their documentation.