ngx-country-select
v2.0.6
Published
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": [
Maintainers
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 --saveConsuming 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 --saveand 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 buildTo lint all *.ts files:
$ npm run lintLicense
MIT © Nikolas Pafitis
