https://github.com/hueitan/angular-validation
[INACTIVE] Client Side Validation for AngularJS 1. (You should use version > 2 :boom:)
https://github.com/hueitan/angular-validation
angular angularjs javascript validation validations
Last synced: 7 months ago
JSON representation
[INACTIVE] Client Side Validation for AngularJS 1. (You should use version > 2 :boom:)
- Host: GitHub
- URL: https://github.com/hueitan/angular-validation
- Owner: hueitan
- Created: 2013-12-13T02:39:08.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2020-10-30T21:27:48.000Z (about 5 years ago)
- Last Synced: 2025-05-08T17:04:50.618Z (7 months ago)
- Topics: angular, angularjs, javascript, validation, validations
- Language: JavaScript
- Homepage: http://hueitan.github.io/angular-validation/
- Size: 1.31 MB
- Stars: 702
- Watchers: 28
- Forks: 176
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
README
angular-validation 1.4.5
=========================
[](http://badge.fury.io/js/angular-validation)
[](https://travis-ci.org/hueitan/angular-validation)
[](https://codeclimate.com/github/hueitan/angular-validation)
[](https://coveralls.io/github/hueitan/angular-validation?branch=master)
[](https://david-dm.org/hueitan/angular-validation#info=devDependencies)
Client-side Validation should be simple and clean.
Don't let Client-side Validation dirty your controller.
Setup your Validation on config phase by using some rules [(example)](https://github.com/hueitan/angular-validation/blob/master/dist/angular-validation-rule.js)
If you prefer schema over html attributes , try [angular-validation-schema
](https://github.com/thetutlage/angular-validation-schema) [(Demo)](http://plnkr.co/edit/X56HEsDYgYoY8gbSj7cu?p=preview)
And add Validation in your view only.
angularjs 1.2.x support to version [angular-validation 1.2.x](https://github.com/hueitan/angular-validation/tree/v1.2.x)
angularjs 1.3.x support after version [angular-validation 1.3.x](https://github.com/hueitan/angular-validation/tree/v1.3.x)
angularjs 1.4.x support after version angular-validation 1.4.x
Requirement
-----
[AngularJS](http://angularjs.org) 1.2.x (for [angular-validation 1.2.x](https://github.com/hueitan/angular-validation/tree/v1.2.x))
[AngularJS](http://angularjs.org) 1.3.x (for [angular-validation 1.3.x](https://github.com/hueitan/angular-validation/tree/v1.3.x))
[AngularJS](http://angularjs.org) 1.4.x (for [angular-validation 1.4.x](https://github.com/hueitan/angular-validation/tree/master))
DEMO
-----
http://hueitan.github.io/angular-validation/
Install
-----
Install with npm
```
npm install angular-validation
```
or with bower
```
bower install angular-validation
```
Using angular-validation
---
```html
```
```js
angular.module('yourApp', ['validation']);
// OR including your validation rule
angular.module('yourApp', ['validation', 'validation.rule']);
```
Writing your First Code
====
```html
Required
Url
Submit
Reset
```
[Documentation API](https://github.com/hueitan/angular-validation/blob/master/API.md)
Built-in validation in angular-validation-rule
===
1. Required
2. Url
3. Email
4. Number
5. Min length
6. Max length
5 and 6 require you to pass an inline parameter to set the length limit. Eg, `maxlength=6`.
Anyone can give a `PR` for this angular-validation for more `built-in validation`
Integrating with Twitter Bootstrap
=====
To integrate this package with Bootstrap you should do the following.
Add the following LESS to your project
```css
.ng-invalid.ng-dirty{
.has-error .form-control;
}
label.has-error.control-label {
.has-error .control-label;
}
```
Change the Error HTML to something like:
```javascript
$validationProvider.setErrorHTML(function (msg) {
return "" + msg + "";
});
```
You can add the bootstrap class `.has-success` in a similar fashion.
To toggle `.has-error` class on bootstrap `.form-group` wrapper for labels and controls, add:
```javascript
angular.extend($validationProvider, {
validCallback: function (element){
$(element).parents('.form-group:first').removeClass('has-error');
},
invalidCallback: function (element) {
$(element).parents('.form-group:first').addClass('has-error');
}
});
```
License
-----
MIT
CHANGELOG
=====
See [release](https://github.com/hueitan/angular-validation/releases)
CONTRIBUTORS
=====
Thank you for your contribution [@lvarayut](https://github.com/lvarayut) and [@Nazanin1369](https://github.com/Nazanin1369) :heart:
Thanks for all [contributors](https://github.com/hueitan/angular-validation/graphs/contributors)