I have a simple element inside my HTML. When a key is released inside of it, a call is made to a method that writes to the console. The issue I'm having is that the console is being written to twice. So I'm assuming that (keyup) is being hit twice, am I right?
Here is my ng2=completer:
<ng2-completer #from [(ngModel)]="fromSearch" [datasource]="airportCodeList" [minSearchLength]="0" (keyup)="onKey()"></ng2-completer>
Below is the onKey method being called:
onKey(entry: string) {
console.log("Key Pressed");
}
Any help would be much appreciated.
Try to put ng2-completer into a div and move (keyup)="onKey()" to the div like:
<div (keyup)="onKey()">
<ng2-completer #from [(ngModel)]="fromSearch"
[datasource]="airportCodeList" [minSearchLength]="0"></ng2-completer>
</div>