1.0.0 • Published 8 years ago

@vendasta/country-state-sdk v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
8 years ago

Country-State SDK

This provides a service to retrieve country/state data.

Requirements

Install to your project:

npm install @vendasta/country-state-sdk --save

Next, you will need to import and setup your navigation module (generally in app.module.ts)

import { CountryStateModule } from "@vendasta/country-state-sdk";
…
@NgModule({
  …
  imports: [
    …, CountryStateModule, …
  ]
})

The Country-State sdk currently requires two endpoints be provided by the client's domain, one to retrieve the list of countries, and one to retrieve the list of states given a country. These endpoints are easily implemented in python as simple wrappers around vautil (see VBC for example).

Future work should direct these calls to a common microservice or source of data.

Methods

getCountriesOptions(): Promise<Country[]>

Returns a promise of a list of countries (name and ISO-3166 alpha-2 code)

getStatesOptions(countryCode: string): Promise<State[]>

Returns a a promise of a list of states (name and code) for the provided countryCode (ISO-3166 alpha-2)