ngx-country-select

Based on the awesome country-select-js by mrmarkfrench(https://github.com/mrmarkfrench/country-select-js) ## Installation First you need jquery and country-select-js installed. Import them to your angular-cli file like this ```json "styles": [

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
ngx-country-select
2.0.66 years ago6 years agoMinified + gzip package size for ngx-country-select in KB

Readme

ngx-country-select
Based on the awesome country-select-js by mrmarkfrench(https://github.com/mrmarkfrench/country-select-js)

Installation

First you need jquery and country-select-js installed. Import them to your angular-cli file like this
"styles": [
  "../node_modules/country-select-js/build/css/countrySelect.css",
],
"scripts": [
  "../node_modules/jquery/dist/jquery.js",
  "../node_modules/country-select-js/build/js/countrySelect.js"
],
To install this library, run:
$ npm install ngx-country-select --save

Consuming your library

Once you have published your library to npm, you can import your library in any Angular application by running:
$ npm install ngx-country-select --save

and then from your Angular AppModule:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';

// Import your library
import { NgxCountrySelectModule } from 'ngx-country-select';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,

    // Specify your library as an import
    NgxCountrySelectModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Once your library is imported, you can use its components, directives and pipes in your Angular application:
<!-- You can now use your library component in app.component.html -->
<input #countrySelect="ngx-country-select"
       ngxCountrySelect....>...

To select country or get country data manually:
import ...
@Component({
  selector: 'app-form',
  templateUrl: './form.component.html',
  styleUrls: ['./form.component.css']
})
export class FormComponent implements OnInit, AfterViewInit {
  @ViewChild('countrySelect') countrySelect;
  setCountry(countryCode) {
    this.countrySelect.setCountry(countryCode);
  }
  getCountryData() {
    return this.countrySelect.getCountryData();
  }
}

Development

To generate all *.js, *.d.ts and *.metadata.json files:
$ npm run build

To lint all *.ts files:
$ npm run lint

License

MIT © Nikolas Pafitis