0.3.4 • Published 7 years ago

angular-oib-validator v0.3.4

Weekly downloads
12
License
MIT
Repository
github
Last release
7 years ago

angular oib validator

Build Status codecov npm version devDependency Status GitHub issues GitHub stars GitHub license

Demo

https://dzivo.github.io/angular-oib-validator/

Table of contents

About

Angular OIB validator

Installation

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 { checkOibValidator } from '../src/oib-validator';

@Component({
  selector: 'oib-demo-app',
  template: `
  <div class="container">
    <form [formGroup]="form">
        <h1>Simple Example Validator</h1>
        <input type="text" formControlName="oib">
        <div *ngIf="form.controls.oib.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': [null, [Validators.required, checkOibValidator]]
    });
  }
}

You may also find it useful to view the demo source.

Usage without a module bundler

<script src="node_modules/angular-oib-validator/bundles/angular-oib-validator.umd.js"></script>
<script>
    // everything is exported angularOibValidator namespace
</script>

Documentation

All documentation is auto-generated from the source via compodoc and can be viewed here: https://dzivo.github.io/angular-oib-validator/docs/

Development

Prepare your environment

  • Install Node.js and NPM
  • Install local dev dependencies: npm install while current directory is this repo

Development server

Run npm start to start a development server on port 8000 with auto reload + tests.

Testing

Run npm test to run tests once or npm run test:watch to continually run tests.

Release

  • Bump the version in package.json (once the module hits 1.0 this will become automatic)
npm run release

License

MIT

0.3.4

7 years ago

0.3.2

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago