ngx-google-places-autocomplete
ngx-google-places-autocomplete copied to clipboard
When used with *ngIf, .pac-container DOM element gets duplicated
If you have the ngx-places input inside a tab with *ngIf, navigating back and forth will produce multiple .pac-container elements
I had to write a function to remove them on cleanup:
public checkAndRemoveElement() {
const ele = document.querySelectorAll('.pac-container');
for (const e of ele) {
e.remove();
}
}