I'm building an Ionic 3 app, where I have made an "auto-complete" directive, which is a simple directive that pops up an auto-complete dialog when the element gets focus. This is done in "auto-complete" via:
@HostListener('ionFocus', ['$event._native.nativeElement'])
onFocus(target) {
target.blur();
this.showAutocompleteDialog(target);
}
This worked when I only used the directive in pages that were only used once in the system.
But then I made a new component, let's call it "AddressField", which has a "auto-complete" directive in one of the elements in its template. Now the @HostListener onFocus event gets triggered twice and hence two autocomplete dialogs are shown.
This only happens for the "auto-complete" directives within the AddressField components, and it only triggers twice for the second instance of "AddressField" in the system.
Am I somehow using the @HostListener in a wrong way, or does this sound like a bug that should be filed? In either case, a workaround of some sort would be really helpful.
Thanks