npm.io
19.0.6 • Published 1 year ago

ng-form-validator-builder

Licence
Version
19.0.6
Deps
1
Size
99 kB
Vulns
0
Weekly
0

Validation Builder

Built with one purpose - Make Reactive form validation in Angular easier to use.


Getting started

Take a look at the live demo to play around with the validators

Install the library

npm i ng-form-validator-builder

Start using the validators

You can add validators using the formBuilder to create a form:

const nextWeek: Date = new Date();
nextWeek.setDate(new Date().getDate() + 7);

const form = new FormBuilder().group({
    someDate: [new Date(), DateValidator.isBefore(nextWeek),
    anotherDate: [new Date(), DateValidator.isBefore(nextWeek, 'With a custom error message'),
});

Combining Validators

TODO: Add documentation here


How it works behind the scenes

TODO: Add documentation on how the validators work with the builders.


Extending validators

TODO: Add documentation on extending validation builders to create custom validators and extend on existing validators.

Keywords