ngx-nic-parser
TypeScript icon, indicating that this package has built-in type declarations

0.1.7 • Public • Published

Calculate DOB/Gender for Srilankan National Identity Card using Angular

NPM version The MIT License The MIT License

Getting started

Step 1: Install ng-bootstrap

   ng add @ng-bootstrap/ng-bootstrap

Step 2: Install ngx-nic-parser

    npm install ngx-nic-parser --save

Example usage:

Add the NgxNicParserModule to the imports of the module.

      import {NgxNicParserModule} from "ngx-nic-parser";

      @NgModule({
        imports: [
          NgxNicParserModule
        ]
      })

Add the element to your HTML:

<ngx-nic-parser
  [title]="'title'"
  [placeholder]="'placeholder'"
  (checkDob)="generate($event)"
  [id]="'id'"
  [patternErrorMessage]="'invalid pattern!'"
  [requiredMessage]="'is required!'">
</ngx-nic-parser>

And add this to your ts file:

export class AppComponent {
  generate($event: any) {
    console.log($event);
  }
}

Success Response

{
    "status": {
        "code": 200,
        "message": ""
    },
    "response": {
        "day": 9,
        "monthName": "JUNE",
        "month": 6,
        "year": 1999,
        "gender": "Male",
        "weekDay": "Friday"
    }
}

Inputs

Name Type Default Description
title string null Label Name
placeholder string null placeholder for the input field.
id string null Id for input field.
patternErrorMessage string null Error Message when input an incorrect pattern.
requiredMessage string null Field is required message.

Outputs

Name Type Description
checkDob method Method to calculate DOB

Package Sidebar

Install

npm i ngx-nic-parser

Weekly Downloads

2

Version

0.1.7

License

MIT

Unpacked Size

105 kB

Total Files

22

Last publish

Collaborators

  • chiranjayadenuwan