Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/naologic/angular-super-validator
A form validator library for deep validation and error extraction
https://github.com/naologic/angular-super-validator
angular angular-cli angular4 angular5 error-extraction forms validator
Last synced: 30 days ago
JSON representation
A form validator library for deep validation and error extraction
- Host: GitHub
- URL: https://github.com/naologic/angular-super-validator
- Owner: naologic
- License: mit
- Created: 2017-10-29T13:31:37.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-30T23:29:07.000Z (over 6 years ago)
- Last Synced: 2024-10-03T15:33:37.960Z (about 1 month ago)
- Topics: angular, angular-cli, angular4, angular5, error-extraction, forms, validator
- Language: TypeScript
- Size: 213 KB
- Stars: 9
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# angular-super-validator
[![npm version](https://badge.fury.io/js/angular-super-validator.svg)](https://badge.fury.io/js/angular-super-validator)
![npm](https://img.shields.io/npm/v/angular-super-validator.svg)
![npm](https://img.shields.io/npm/v/angular-super-validator/next.svg)
![npm](https://img.shields.io/npm/l/angular-super-validator.svg)
![npm](https://img.shields.io/npm/dm/angular-super-validator.svg)A form validator library for deep validation and error extraction from Angular Forms
## Install
```sh
$ npm install --save angular-super-validator
```## Import
```typescript
import { SuperForm } from "angular-super-validator";
```## Use in FormGroup
```typescript
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 :heart: in :uk: