{"id":13808893,"url":"https://github.com/angular-material-extensions/select-country","last_synced_at":"2025-04-04T23:09:47.800Z","repository":{"id":36140148,"uuid":"220078160","full_name":"angular-material-extensions/select-country","owner":"angular-material-extensions","description":"Angular Material component that allow users to select a country or nationality with an autocomplete feature","archived":false,"fork":false,"pushed_at":"2024-07-16T07:42:59.000Z","size":17727,"stargazers_count":127,"open_issues_count":36,"forks_count":42,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-28T22:13:38.225Z","etag":null,"topics":["angular","country","countrypicker","languages","material","materialdesign","nationality","ng","ngx","select"],"latest_commit_sha":null,"homepage":"https://angular-material-extensions.github.io/select-country/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/angular-material-extensions.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"angular-material-extensions","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":"npm/@angular-material-extensions/select-country","community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":["https://github.com/AnthonyNahas","anahas.de"]}},"created_at":"2019-11-06T19:54:19.000Z","updated_at":"2025-02-12T22:11:29.000Z","dependencies_parsed_at":"2024-06-18T15:24:17.806Z","dependency_job_id":"c1276291-6524-408f-8c6d-416eadbcd932","html_url":"https://github.com/angular-material-extensions/select-country","commit_stats":{"total_commits":345,"total_committers":17,"mean_commits":"20.294117647058822","dds":0.1942028985507246,"last_synced_commit":"b2175c693c4af1fc45d9e215f57bb794d2767059"},"previous_names":[],"tags_count":54,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angular-material-extensions%2Fselect-country","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angular-material-extensions%2Fselect-country/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angular-material-extensions%2Fselect-country/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angular-material-extensions%2Fselect-country/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/angular-material-extensions","download_url":"https://codeload.github.com/angular-material-extensions/select-country/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247261612,"owners_count":20910108,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","country","countrypicker","languages","material","materialdesign","nationality","ng","ngx","select"],"created_at":"2024-08-04T01:01:54.389Z","updated_at":"2025-04-04T23:09:47.784Z","avatar_url":"https://github.com/angular-material-extensions.png","language":"TypeScript","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"angular-material-extensions's logo\"\n   height=\"256px\" width=\"256px\" style=\"text-align: center;\"\n   src=\"https://cdn.jsdelivr.net/gh/angular-material-extensions/select-country@master/assets/angular-material-extensions-logo.svg\"\u003e\n\u003c/p\u003e\n\n# @angular-material-extensions/select-country - Angular Material component that allow users to select a country or nationality with an autocomplete feature\n\n[![npm version](https://badge.fury.io/js/%40angular-material-extensions%2Fselect-country.svg)](https://badge.fury.io/js/%40angular-material-extensions%2Fselect-country)\n[![npm demo](https://img.shields.io/badge/demo-online-ed1c46.svg)](https://angular-material-extensions.github.io/select-country)\n[![docs: typedoc](https://img.shields.io/badge/docs-typedoc-4D0080.svg)](https://angular-material-extensions.github.io/select-country/doc/index.html)\n[![Join the chat at https://gitter.im/angular-material-extensions/Lobby](https://badges.gitter.im/angular-material-extensions/Lobby.svg)](https://gitter.im/angular-material-extensions/Lobby?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n[![Build Status](https://travis-ci.org/angular-material-extensions/select-country.svg?branch=master)](https://travis-ci.org/angular-material-extensions/select-country)\n[![codecov](https://codecov.io/gh/angular-material-extensions/select-country/branch/master/graph/badge.svg)](https://codecov.io/gh/angular-material-extensions/select-country)\n[![Greenkeeper Badge](https://badges.greenkeeper.io/angular-material-extensions/select-country.svg)](https://greenkeeper.io/)\n[![license](https://img.shields.io/github/license/angular-material-extensions/select-country.svg?style=flat-square)](https://github.com/angular-material-extensions/select-country/blob/master/LICENSE)\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"@angular-material-extensions/select-country demonstration\" style=\"text-align: center;\"\n   src=\"https://raw.githubusercontent.com/angular-material-extensions/select-country/HEAD/assets/v0.2.0/select-country.gif\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"@angular-material-extensions/select-country demonstration\" style=\"text-align: center;\"\n   src=\"https://raw.githubusercontent.com/angular-material-extensions/select-country/HEAD/assets/v0.2.0/select-country.png\"\u003e\n\u003c/p\u003e\n\n## Built by and for developers :heart:\nDo you have any question or suggestion ? Please do not hesitate to contact us!\nAlternatively, provide a PR | open an appropriate issue [here](https://github.com/angular-material-extensions/select-country/issues)\n\nIf you like this project, support [angular-material-extensions](https://github.com/angular-material-extensions)\nby starring :star: and sharing it :loudspeaker:\n\n## Table of Contents\n- [Demo](#demo)\n- [Components](#components)\n- [Dependencies](#dependencies)\n- [Installation](#installation)\n- [API](#api)\n- [Usage](#usage)\n- [Run Demo App Locally](#run-demo-app-locally)\n- [Other Angular Libraries](#other-angular-libraries)\n- [Support](#support)\n- [License](#license)\n\n\u003ca name=\"demo\"/\u003e\n\n## [Demo](https://angular-material-extensions.github.io/select-country)\n\nView all the directives and components in action at [https://angular-material-extensions.github.io/select-country](https://angular-material-extensions.github.io/select-country)\n\n\u003ca name=\"components\"/\u003e\n\n## Library's components\n- `\u003cmat-select-country\u003e` used to display the main component\n\n---\n\n\u003ca name=\"dependencies\"/\u003e\n\n## Dependencies\n* [Angular](https://angular.io) developed and tested with `17.x`\n\n---\n\n\u003ca name=\"installation\"/\u003e\n\n##  [Installation](https://angular-material-extensions.github.io/select-country/getting-started)\n\n## 1. Install via *ng add*. (Recommended)\n\nIf Angular Material Design is not setup, just run `ng add @angular/material` [learn more](https://material.angular.io/guide/getting-started)\n\nNow add the library via the `angular schematics`\n```shell\nng add @angular-material-extensions/select-country\n```\n\n## 2. Install via *npm*. (Alternative)\n\nInstall peer dependencies\n```shell\nnpm i svg-country-flags -s\n```\n\nthen update your `angular.json` like below (svg-country-flags)\n\n```json\n\"assets\": [\n              \"src/favicon.ico\",\n              \"src/assets\",\n              {\n                \"glob\": \"**/*\",\n                \"input\": \"./node_modules/svg-country-flags/svg\",\n                \"output\": \"src/assets/svg-country-flags/svg\"\n              }\n            ],\n```\n\nNow install `@angular-material-extensions/select-country` via:\n\n```shell\nnpm install --save @angular-material-extensions/select-country\n```\n\n### Import the library\n\nIf you installed the library via angular schematics, you can skip this step\n\nOnce installed you need to import the main module and the `HttpClientModule`:\n\n```js\nimport { MatSelectCountryModule } from \"@angular-material-extensions/select-country\";\n```\n\n```typescript\nimport { MatSelectCountryModule } from '@angular-material-extensions/select-country';\nimport {HttpClientModule} from '@angular/common/http';\n\n@NgModule({\n  declarations: [AppComponent, ...],\n  imports: [\n              MatSelectCountryModule.forRoot('de'), // you can use 'br' | 'de' | 'en' | 'es' | 'fr' | 'hr' | 'hu' | 'it' | 'nl' | 'pt' --\u003e MatSelectCountrySupportedLanguages\n             HttpClientModule, ...],\n  bootstrap: [AppComponent]\n})\nexport class AppModule {\n}\n```\n\nin other modules\n\n```typescript\nimport { MatSelectCountryModule } from '@angular-material-extensions/select-country';\nimport {HttpClientModule} from '@angular/common/http';\n\n@NgModule({\n  declarations: [AppComponent, ...],\n  imports: [MatSelectCountryModule, HttpClientModule, ...],\n  bootstrap: [AppComponent]\n})\nexport class AppModule {\n}\n```\n\nOther modules in your application like for lazy loading import `MatSelectCountryModule` into your feature module:\n\n\u003ca name=\"api\"/\u003e\n\n## API\n\n### `\u003cmat-select-country\u003e` used to display the main component - [see the demo examples](https://angular-material-extensions.github.io/select-country/examples)\n\n| option            |    bind    |           type           |             default             | description                                                                                        |\n| :---------------- | :--------: | :----------------------: | :-----------------------------: | :------------------------------------------------------------------------------------------------- |\n| value             | `Input()`  |        `Country`         |                -                | the selected country (pass an empty Country object with alpha2 code populated to do alpha2 lookup) |\n| appearance        | `Input()`  | `MatFormFieldAppearance` |                -                | Possible appearance styles for `mat-form-field` ('legacy', 'standard', 'fill' or 'outline')        |\n| countries         | `Input()`  |       `Country[]`        | All countries stored in the lib | Countries that should be loaded - predefine the countries that you only need!                      |\n| label             | `Input()`  |        `boolean`         |                -                | `mat-form-field` label's text                                                                      |\n| itemsLoadSize     | `Input()`  |         `number`         |                -                | the number of countries that should be fetched --\u003e improves the performance                        |\n| placeHolder       | `Input()`  |        `boolean`         |                -                | input placeholder text                                                                             |\n| disabled          | `Input()`  |        `boolean`         |                -                | Whether the component is disabled                                                                  |\n| loading           | `Input()`  |        `boolean`         |                -                | Whether the component is loading                                                                   |\n| nullable          | `Input()`  |        `boolean`         |                -                | Whether the component is able to emit `null`                                                       |\n| readonly          | `Input()`  |        `boolean`         |                -                | Whether the component is read only                                                                 |\n| tabIndex          | `Input()`  |    `number \\| string`    |                -                | Whether the component can be focused, and where it participates in sequential keyboard navigation  |\n| showCallingCode   | `Input()`  |        `boolean`         |              false              | Whether the component to show the country's calling code in the label and selection                |\n| class             | `Input()`  |         `string`         |                -                | Class attribute apply style to input text or validation ignore (optional)                          |\n| language          | `Input()`  |         `string`         |                -                | the language, if not specified MatSelectCountryModule.forRoot('XX') will be used (optional)        |\n| name              | `Input()`  |         `string`         |             'country'           | the attribute name of the input element                                                            |\n| autocomplete      | `Input()`  |         `string`         |                -                | the attribute autocomplete of the input element, to avoid suggestion of some browsers put 'no'     |\n| onCountrySelected | `Output()` | `EventEmitter\u003cCountry\u003e`  |                -                | emits the selected country as object (see the interface below)                                     |\n\n```typescript\ninterface Country {\n  name: string;\n  alpha2Code: string;\n  alpha3Code: string;\n  numericCode: string;\n  callingCode: string;\n}\n```\n\n\n\u003ca name=\"usage\"/\u003e\n\n## [Usage](https://angular-material-extensions.github.io/select-country)\n\nadd the `\u003cmat-select-country\u003e` element to your template:\n\n```html\n\u003cmat-select-country\u003e\n\u003c/mat-select-country\u003e\n```\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"@angular-material-extensions/select-country demonstration\" style=\"text-align: center;\"\n   src=\"https://raw.githubusercontent.com/angular-material-extensions/select-country/HEAD/assets/v0.2.0/example_full.png\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"@angular-material-extensions/select-country demonstration\" style=\"text-align: center;\"\n   src=\"https://raw.githubusercontent.com/angular-material-extensions/select-country/HEAD/assets/v0.2.0/example3.png\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"@angular-material-extensions/select-country demonstration\" style=\"text-align: center;\"\n   src=\"https://raw.githubusercontent.com/angular-material-extensions/select-country/HEAD/assets/v0.2.0/example2.png\"\u003e\n\u003c/p\u003e\n\n\n#### Use the library with reactive forms\n\n### option 1 with Reactive Forms\n\n```html\n\u003cmat-select-country appearance=\"outline\"\n                    label=\"Country\"\n                    [formControl]=\"countryFormControl\"\n                    (onCountrySelected)=\"onCountrySelected($event)\"\u003e\n\u003c/mat-select-country\u003e\n```\n\n### option 2 with Reactive Forms\n\n```html\n\u003cform [formGroup]=\"countryFormGroup\"\u003e\n    \u003cdiv fxLayoutAlign=\"center\"\u003e\n      \u003cmat-select-country appearance=\"outline\"\n                          label=\"Country\"\n                          class=\"className\"\n                          formControlName=\"country\"\n                          (onCountrySelected)=\"onCountrySelected($event)\"\u003e\n      \u003c/mat-select-country\u003e\n    \u003c/div\u003e\n  \u003c/form\u003e\n```\n\n```typescript\nimport {Component,OnInit} from '@angular/core';\nimport {FormControl} from '@angular/forms';\n\nimport {Country} from '@angular-material-extensions/select-country';\n\n@Component({\n  selector: 'app-root',\n  templateUrl: './app.component.html',\n  styleUrls: ['./app.component.scss']\n})\nexport class AppComponent implements OnInit{\n  title = 'select-country';\n\n  countryFormControl = new FormControl();\n  countryFormGroup: FormGroup;\n\n  constructor(private formBuilder: FormBuilder) {\n    angulartics2GoogleAnalytics.startTracking();\n  }\n\n  ngOnInit(): void {\n\n    this.countryFormGroup = this.formBuilder.group({\n      country: []\n    });\n\n    this.countryFormGroup.get('country').valueChanges\n.subscribe(country =\u003e console\n.log('this.countryFormGroup.get(\"country\").valueChanges', country));\n\n    this.countryFormControl.valueChanges\n.subscribe(country =\u003e console\n.log('this.countryFormControl.valueChanges', country));\n  }\n\n\n  onCountrySelected($event: Country) {\n    console.log($event);\n  }\n}\n\n```\n\n\n### Predefine your countries to load\n\n```html\n\u003cmat-select-country appearance=\"outline\"\n                    label=\"Country\"\n                    [countries]=\"predefinedCountries\"\n                    (onCountrySelected)=\"onCountrySelected($event)\"\u003e\n\u003c/mat-select-country\u003e\n```\n\n```typescript\nimport {Country} from '@angular-material-extensions/select-country';\n\npredefinedCountries: Country[] = [\n  {\n    name: 'Germany',\n    alpha2Code: 'DE',\n    alpha3Code: 'DEU',\n    numericCode: '276',\n    callingCode: '+49'\n  },\n  {\n    name: 'Greece',\n    alpha2Code: 'GR',\n    alpha3Code: 'GRC',\n    numericCode: '300',\n    callingCode: '+30'\n  },\n  {\n    name: 'France',\n    alpha2Code: 'FR',\n    alpha3Code: 'FRA',\n    numericCode: '250',\n    callingCode: '+33'\n  },\n  {\n    name: 'Belgium',\n    alpha2Code: 'BE',\n    alpha3Code: 'BEL',\n    numericCode: '056',\n    callingCode: '+32'\n  }\n];\n```\n\nResult:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"@angular-material-extensions/select-country demonstration\" style=\"text-align: center;\"\n   src=\"https://raw.githubusercontent.com/angular-material-extensions/select-country/HEAD/assets/v2.1.0/predefined.png\"\u003e\n\u003c/p\u003e\n\n\n### Improve performance - use the `itemsLoadSize` property\n\n```html\n\u003cmat-select-country appearance=\"outline\"\n                    label=\"Country\"\n                    [itemsLoadSize]=\"5\"\u003e\n\u003c/mat-select-country\u003e\n```\n\nonly 5 countries will fetched!\n\n### Change language dynamically - use the `language` property\n```html\n\u003cmat-select-country appearance=\"outline\"\n                    label=\"Country\"\n                    [language]=\"languageSelected\"\n                    (onCountrySelected)=\"onCountrySelected($event)\"\u003e\n\u003c/mat-select-country\u003e\n```\n\n\n\u003ca name=\"run-demo-app-locally\"/\u003e\n\n###  Run Demo App Locally\n\n\nBuild the library\n\n```bash\n$ npm run build:lib\n```\n\nServe the demo app\n\n```bash\n$ npm start\n```\n\n\n\n## Other Angular Libraries\n- [ngx-auth-firebaseui](https://github.com/AnthonyNahas/ngx-auth-firebaseui)\n- [ngx-linkifyjs](https://github.com/AnthonyNahas/ngx-linkifyjs)\n- [@angular-material-extensions/password-strength](https://github.com/angular-material-extensions/password-strength)\n- [@angular-material-extensions/google-maps-autocomplete](https://github.com/angular-material-extensions/google-maps-autocomplete)\n- [@angular-material-extensions/link-preview](https://github.com/angular-material-extensions/link-preview)\n- [@angular-material-extensions/fab-menu](https://github.com/angular-material-extensions/fab-menu)\n- [@angular-material-extensions/pages](https://github.com/angular-material-extensions/pages)\n- [@angular-material-extensions/contacts](https://github.com/angular-material-extensions/contacts)\n---\n\n\u003ca name=\"who_is_using_this_lib\"/\u003e\n\n## Who is using this library?\n\n[nahaus.de](https:/nahaus.de) - Digital and Automated Real Estate Management\n\nTo put your project here, please drop an appropriate PR\n\n-----\n\n\u003ca name=\"support\"/\u003e\n\n## Support\n+ Drop an email to: [Anthony Nahas](mailto:anthony.na@hotmail.de)\n+ or open an appropriate [issue](https://github.com/angular-material-extensions/select-country/issues)\n+ let us chat on [Gitter](https://gitter.im/angular-material-extensions/Lobby)\n\n Built by and for developers :heart: we will help you :punch:\n\n---\n\n![jetbrains logo](https://raw.githubusercontent.com/angular-material-extensions/select-country/HEAD/assets/jetbrains-variant-4_logos/jetbrains-variant-4.png)\n\nThis project is supported by [jetbrains](https://www.jetbrains.com/) with 1 ALL PRODUCTS PACK OS LICENSE incl. [webstorm](https://www.jetbrains.com/webstorm)\n\n---\n\n\u003ca name=\"license\"/\u003e\n\n## License\n\nCopyright (c) 2020-2024 [Anthony Nahas](https://github.com/AnthonyNahas). Licensed under the MIT License (MIT) \u003cp align=\"center\"\u003e\n                                                                                                            \u003cimg alt=\"angular-material-extensions's logo\"\n                                                                                                             height=\"92px\" width=\"92px\" style=\"text-align: center;\"\n                                                                                                             src=\"https://cdn.jsdelivr.net/gh/angular-material-extensions/select-country@master/assets/badge_made-in-germany.svg\"\u003e\n                                                                                                          \u003c/p\u003e\n","funding_links":["https://github.com/sponsors/angular-material-extensions","https://tidelift.com/funding/github/npm/@angular-material-extensions/select-country","https://github.com/AnthonyNahas","anahas.de"],"categories":["Table of contents"],"sub_categories":["Third Party Components"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangular-material-extensions%2Fselect-country","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fangular-material-extensions%2Fselect-country","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangular-material-extensions%2Fselect-country/lists"}