webcat12345 / ngx-intl-tel-input

Phone number input field to support international numbers, Angular
MIT License
213 stars 333 forks source link

ngOnChanges deal with onlyCountries updates #500

Open abpprkonsalting opened 10 months ago

abpprkonsalting commented 10 months ago

When updating onlyCountries after been initialized the component (e.g.: loading from backend) the new values of onlyCountries does not get updated in ngx-intl-tel-input.

Checking in ngOnChanges for changes['onlyCountries'] and updating as necessary solved the issue:

if (changes['onlyCountries']) { this.allCountries = this.allCountries.filter((c) => this.onlyCountries.includes(c.iso2)); }