I am using PrimeNG autocomplete textbox. How can I send value to my component on onBlur
event ?
Template
<p-autoComplete (ngModelChange)="orguser.userid = $target.value"
class="ui-autocomplete autocomplete" [suggestions]="results"
(completeMethod)="search($event)" (onSelect)="onSelect($event)"
(onBlur)="onBlur($event)" field="userid"></p-autoComplete>
Component
onBlur(value) {
console.log(value); // I have tried a number of things like value.target etc
}
(onBlur)="onBlur(orguser.userid )"
also does not work
With (onBlur)="onBlur($event)"
try this :
onBlur(event) {
console.log(event.target.value);
}
You should get what you typed with your keyboard.
And with
onSelect(value) {
console.log(value);
}
you will have the selected item value.
See StackBlitz