angular-super-validator
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

angular-super-validator

npm version npm npm npm npm

A form validator library for deep validation and error extraction from Angular Forms

Install

$ npm install --save angular-super-validator

Import

import { SuperForm } from "angular-super-validator";

Use in FormGroup

const fg = new FormGroup({
     id: new FormControl(0, [Validators.required]),
     name: new FormControl('', [Validators.required]),
     description: new FormControl('', [Validators.required, Validators.maxLength(200)]),
     isSkipped: new FormControl(false),
});
 
if (!fg.valid) {
    const errors = SuperForm.getAllErrors(fg);
    const errorsFlat = SuperForm.getAllErrorsFlat(fg);
 
    console.log(errors);
}
 

Made with ❤️ in 🇬🇧

Package Sidebar

Install

npm i angular-super-validator

Weekly Downloads

300

Version

2.0.0

License

MIT

Unpacked Size

58.9 kB

Total Files

26

Last publish

Collaborators

  • gp187