https://dzivo.github.io/angular-oib-validator/
Angular OIB validator
Install through npm:
npm install --save angular-oib-validator
Then include in your apps module:
import { Component, NgModule } from '@angular/core';
import { AngularOibValidatorModule } from 'angular-oib-validator';
@NgModule({
imports: [
AngularOibValidatorModule.forRoot()
]
})
export class MyModule {}
Finally use in one of your apps components:
import { Component, OnInit } from '@angular/core';
import { FormGroup, FormControl, Validators, FormBuilder, FormArray, AbstractControl, ValidationErrors } from '@angular/forms';
import { OibValidator } from 'angular-oib-validator';
@Component({
selector: 'oib-demo-app',
template: `
<div class="container">
<form [formGroup]="form">
<h1>Simple Example Validator</h1>
<input type="text" formControlName="oib-simple">
<div *ngIf="form.controls.oib-simple.errors?.validateOib">This doesn't appear to be a valid oib address.</div>
</form>
</div>
`
})
export class DemoComponent implements OnInit {
form: FormGroup;
constructor(
private _fb: FormBuilder) {
}
ngOnInit(): void {
this.form = this._fb.group({
'oib-simple': [null, [OibValidator.check]]
});
}
}
You may also find it useful to view the demo source.
<script src="node_modules/angular-oib-validator/bundles/angular-oib-validator.umd.js"></script>
<script>
// everything is exported angularOibValidator namespace
</script>
All documentation is auto-generated from the source via compodoc and can be viewed here: https://dzivo.github.io/angular-oib-validator/docs/
- Install Node.js and NPM
- Install local dev dependencies:
npm install
while current directory is this repo
Run npm start
to start a development server on port 8000 with auto reload + tests.
Run npm test
to run tests once or npm run test:watch
to continually run tests.
- Bump the version in package.json (once the module hits 1.0 this will become automatic)
npm run release
MIT