ngx-pl-validators
v1.0.1
Published
PESEL, NIP and REGON validators for Angular
Downloads
32
Readme
ngx-pl-validators
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>