angular-validators

More validators for Angular (2+)

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
angular-validators
Minified + gzip package size for angular-validators in KB

Readme

npm version Join the chat at https://gitter.im/angular/angular

angular-validators

Form Validators and a component to display them
Feel free to ping on on the angular/angular gitter if you have any issues

##Installation

npm install --save angular-validators

###Validation Messages A component to easily display validation messages

//imports
import { ValidationMessagesModule } from 'angular-validation';
//-or-
to provide your own error message mapper function do this
providers: [{ provide: 'validationMessageMapper', useValue: validationMessageMapper }]
//please not that `validationMessageMapper` must be of type `ValidationMessageMapperFn`
//usage
<av-validation-messages [control]="myForm.controls.password"></av-validation-messages>

###Validators

//imports
import { FormValidators } from 'angular-validators';
//usage
email: ['', FormValidators.required]

This package incldues all of Angulars inbuilt validators so you don't have to use them from two different places

Validators

Email
Url
Number
Alpha
Credit Card(Visa, Master Card, American Express, Diners, Discover, JBC)

Cross Field Validator

Comparison - depricated in faviour of equalsTo validator comming in Angular version 4.0.0

@angular/form Validators

Required
RequiredTrue
MinLength
MaxLength
Null
Compose
ComposeAsync

Feel free to suggest other validators to be included

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.