angular-material-extensions / select-country

Angular Material component that allow users to select a country or nationality with an autocomplete feature
https://angular-material-extensions.github.io/select-country/
MIT License
126 stars 40 forks source link

feat - rewrite input logic to work with async countries fetching and … #64

Closed dzena closed 3 years ago

dzena commented 3 years ago

…add "excludedCountries" that expects an array of countries to be excluded from the list.

This commit addresses couple of issues and introduces one new feature (exclude countries).

There is a problem if we want to pass [value]="[{alpha2Code: 'DE'}]". In this case, Input() setter tries to lookup "alpha2Code" in the "countries" array, but fetching the countries is async, and at the point of looking up, the array is "undefined".

Also, Input() "value" depends on Input() "countries", so if a user passes "countries" and "value", it can happen that "value" is passed before "countries" so lookup will not work as well.

dzena commented 3 years ago

Hm, there are still some issues to be addressed. Please do not merge yet.

dzena commented 3 years ago

@AnthonyNahas I think we should be good now. Please take a look and let me know if you think the proposed solution makes sense.

AnthonyNahas commented 3 years ago

@dzena thanks for contributing