webcat12345 / ngx-intl-tel-input

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

ngOnChanges deal with onlyCountries updates #500

Open abpprkonsalting opened 1 year ago

abpprkonsalting commented 1 year 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)); }