I expected that the PrimeNG AutoComplete component is emitting the (onSelect) event on and on Keyboard select. But it emits only Keyboard selection. While "[dropdown]=false"
The Example is very simple:
<p-autoComplete ... (onSelect)="onSelect()" ...>
...
onSelect(){
console.log('select', this.suggestions);
}
using: "primeng": "^6.1.4", "@angular/cli": "^6.2.3",
How do I catch a clicked selection on auto-complete suggestions?
Or even better: How can I achieve the "DropdownButton-click" behavior on "InputField-click"? Just to get rid of the dropdown button but keep the behavior.
EDIT:
Its similar to this case, but it doesnt helps me for the Angular way.
Primefaces Autocomplete - How to display dropdown items on click of input
I confirm that this works for me on Angular8/PrimeNG8 ("primeng": "^8.0.0", "@angular/cli": "^8.3.25"). Both when selecting using the mouse or the keyboard: the onSelect gets triggered.
Make sure you pass the event as well:
<p-autoComplete ... (onSelect)="onSelect($event)" ...>
...
onSelect(event: any){
console.log( event );
}
Check "frosty"'s solution/stackblitz. That works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With