PESEL, NIP and REGON validators for Angular
npm install ngx-pl-validatorsNeeds ReactiveFormsModule
import { PLValidators } from 'ngx-pl-validators';
password: FormControl = new FormControl('', Validators.compose([
PLValidators.peselValidator
]));import { PLValidators } from 'ngx-pl-validators';
password: FormControl = new FormControl('', Validators.compose([
PLValidators.nipValidator
]));Needs FormsModule and ValidatorsModule
<form>
<input type="text" [(ngModel)]="model.pesel" name="pesel" #formControl="ngModel" pesel />>
<span *ngIf="formControl.hasError('pesel')">Invalid PESEL</span>
</form><form>
<input type="text" [(ngModel)]="model.nip" name="nip" #formControl="ngModel" nip />>
<span *ngIf="formControl.hasError('nip')">Invalid NIP</span>
</form>