@ngodings/ngx-country
v15.0.9
Published
Simple get all country, get country by code/abbreviation, get code by country, get bbreviation by country & easy use pipe in Angular
Downloads
14
Maintainers
Readme
@ngodings/ngx-country
Simple get all country, get country by code/abbreviation, get code by country, get bbreviation by country & easy use pipe in Angular
Demo - Angular v15
https://npm.ngodings.com/packages/ngx-country
Support Me
If you like this package I will be happy that you support me on Buy me a coffee :) Buy me coffee: https://www.buymeacoffee.com/alidihaw Indonesia People: https://sociabuzz.com/dihaw
Getting Started
Installing and Importing
Install the package by command:
npm install @ngodings/ngx-country --save
Import the module
import { NgxCountryModule, CountryService } from "@ngodings/ngx-country";
@NgModule({
imports: [
...
NgxCountryModule
],
declarations: [...],
providers: [
...
CountryService
]
})
export class AppModule {}
Usage
Import the service
constructor(private countryService: CountryService,) {}
Get All Countries
await this.countryService.getCountries();
Get All Country Codes
await this.countryService.getCountryCodes();
Get Abbreviation By Country
await this.countryService.getAbbreviationByCountry('Singapore');
Get Code By Country
await this.countryService.getCodeByCountry('Singapore');
Get Country By Code
await this.countryService.getCountryByCode('+65');
Get Country By Abbreviation
await this.countryService.getCountryByAbbreviation('SG');
Get Country By Abbreviation - Pipe
{{ 'SG'| countryByAbbreviationPipe | async }}
Get Abbreviation By Country - Pipe
{{ 'Singapore'| abbreviationByCountryPipe | async }}
Get Country By Code - Pipe
{{ '+65'| countryByCodePipe | async }}
Get Code By Country - Pipe
{{ 'Singapore'| codeByCountryPipe | async }}
Development
Prepare your environment
- Install Node.js and NPM
- Install local dev dependencies:
npm install
while current directory is this repo
License
MIT @ Ali Abdul Wahid