indian-postal-codes
TypeScript icon, indicating that this package has built-in type declarations

1.0.14 • Public • Published

indian-postal-codes

Downloads/week

This library was generated with Angular CLI version 14.1.0.

Table of contents

  1. Getting Started
  2. Demo
  3. Installation
  4. Usage
  5. License

Getting Started

indian-postal-codes provides powered by Angular, so you don't need to include original JS components.

Demo

Indian Postal Codes components for Angular applications, demos and API documentation could be found here: http://thaaimozhikalvi.com/demo/pincode.

StackBlitz URL: https://stackblitz.com/indian-postal-codes

Installation

Install indian-postal-codes from npm:

npm install indian-postal-codes --save

Usage

Add wanted package to NgModule imports:

import {IndianPostalCodesModule} from "indian-postal-codes";

@NgModule({
  ...
  imports: [
        ...,
        IndianPostalCodesModule,
        ...]
  ...
})

Add component to your page:

import {IndianPostalCodesService, PostOfficeDetails} from "indian-postal-codes";

@Component({...})

export class AppComponent {
    result: PostOfficeDetails[];
    constructor(private postalCodesService: IndianPostalCodesService) {}
}

Find By PinCodes:

this.postalCodesService.findByPinCode(pinCode).subscribe(data => {
      if (data[0].Status === 'Success') {
        this.result = data[0].PostOffice;
      } else if (data[0].Status === 'Error') {
        alert(data[0].Message);
        this.result = [];
      } else if (data[0].Status === '404') {
        alert(data[0].Message);
        this.result = [];
      }
    });

Find By Post Office:

this.postalCodesService.findByPostOfficeName(postOffice).subscribe(data => {
      if (data[0].Status === 'Success') {
        this.result = data[0].PostOffice;
      } else if (data[0].Status === 'Error') {
        alert(data[0].Message);
        this.result = [];
      } else if (data[0].Status === '404') {
        alert(data[0].Message);
        this.result = [];
      }
    });

Creator

License

indian-postal-codes is MIT licensed.

Package Sidebar

Install

npm i indian-postal-codes

Weekly Downloads

3

Version

1.0.14

License

MIT

Unpacked Size

32.4 kB

Total Files

17

Last publish

Collaborators

  • gpdhanush