ngx-pl-validators

1.0.1 • Public • Published

ngx-pl-validators

Build Status dependencies Status devDependencies Status peerDependencies Status

PESEL, NIP and REGON validators for Angular

Installation

npm install ngx-pl-validators

Usage (model driven)

Needs ReactiveFormsModule

PESEL

import { PLValidators } from 'ngx-pl-validators';

password: FormControl = new FormControl('', Validators.compose([
  PLValidators.peselValidator
]));

NIP

import { PLValidators } from 'ngx-pl-validators';

password: FormControl = new FormControl('', Validators.compose([
  PLValidators.nipValidator
]));

Usage (template driven)

Needs FormsModule and ValidatorsModule

PESEL

<form>
  <input type="text" [(ngModel)]="model.pesel" name="pesel" #formControl="ngModel" pesel />>
  <span *ngIf="formControl.hasError('pesel')">Invalid PESEL</span>
</form>

NIP

<form>
  <input type="text" [(ngModel)]="model.nip" name="nip" #formControl="ngModel" nip />>
  <span *ngIf="formControl.hasError('nip')">Invalid NIP</span>
</form>

Readme

Keywords

Package Sidebar

Install

npm i ngx-pl-validators

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

16.9 kB

Total Files

15

Last publish

Collaborators

  • tomi77