As the question suggests, I have a problem applying the selected
event for ng2-completer
.
It also seems to be an open issue with ng2-completer
because they haven't released any fix for this issue on Github. However there is no work-around solution yet.
Here's the code that I use.
HTML template:
<ng2-completer
[(ngModel)]="searchStr"
[datasource]="items"
[minSearchLength]="0"
[openOnFocus]="true"
[placeholder]="'Please enter'"
[textNoResults]="false"
[maxChars]="6"
(keyup)="onKeyDown($event)"
(selected)="onItemSelect($event)"
(blur)="onTouched()">
</ng2-completer>
Component:
onItemSelect(selected: CompleterItem): void {
console.log('selected item');
console.log(selected);
}
It doesn't print anything when I click or double click on any item. I've tried typing Enter as well but it also doesn't work. Please help to suggest a work around solution for this if you have. Thank you in advance.