@angular-magic/ngx-validator
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

ngx-validator

Ngx-Markdown Logo

Demo: https://ngx-validator.angularmagic.com

This module contains validator component which automatically show message depending by control's validations.

NPM

Installation

npm

npm install @angular-magic/ngx-validator

yarn

yarn add  @angular-magic/ngx-validator

Usage

  1. Add a module into your application (as a rule app.module.ts)
import { NgxValidatorModule } from "@angular-magic/ngx-validator";

@NgModule({
  imports: [NgxValidatorModule, BrowserModule, ReactiveFormsModule, ...],
  ...
})
  1. Add component under your input or controllable UI component
<input type="text" [formControl]="myFormControl" />
<ngx-validator [control]="myFormControl" customName="Name"></ngx-validator>

Options

Validator component support a couple of additional @Input, list of them you can check below:

Name Type Default value Description
control AbstractControl or FormControl Control from which validator will extract validations and show error messages.
customName string By default name of control is extracted from parent name (ex: if we have FormGroup which have FormControl lastName then name of validation will Last Name).
customValidation CustomValidation or CustomValidation[] In case when we need to overwrite default validation messages or add something custom which don't exists in service.

GitHub

Please feel free to declare issues or contribute: https://github.com/angular-magic/ngx-validator

Package Sidebar

Install

npm i @angular-magic/ngx-validator

Weekly Downloads

42

Version

1.0.7

License

MIT

Unpacked Size

103 kB

Total Files

24

Last publish

Collaborators

  • dancornilov