diff --git a/src/app/components/listbox/listbox.interface.ts b/src/app/components/listbox/listbox.interface.ts index 42cfff8145c..506c9286a74 100644 --- a/src/app/components/listbox/listbox.interface.ts +++ b/src/app/components/listbox/listbox.interface.ts @@ -62,7 +62,7 @@ export interface ListboxClickEvent { /** * Selected option */ - option: any; + option?: any; } /** * Custom change event. diff --git a/src/app/components/listbox/listbox.ts b/src/app/components/listbox/listbox.ts index b02e1b228b7..93df7191e6c 100755 --- a/src/app/components/listbox/listbox.ts +++ b/src/app/components/listbox/listbox.ts @@ -749,6 +749,13 @@ export class Listbox implements AfterContentInit, OnInit, ControlValueAccessor, this.value = value; this.modelValue.set(value); this.onModelChange(value); + + if(event && event.type == 'click') { + this.onClick.emit({ + originalEvent: event, + value: value + }); + } } removeOption(option) { diff --git a/src/app/showcase/doc/listbox/basicdoc.ts b/src/app/showcase/doc/listbox/basicdoc.ts index d5ccd1127a4..aabd87e7172 100644 --- a/src/app/showcase/doc/listbox/basicdoc.ts +++ b/src/app/showcase/doc/listbox/basicdoc.ts @@ -17,7 +17,7 @@ interface City {

- +
` @@ -31,6 +31,10 @@ export class BasicDoc implements OnInit { selectedCity!: City; + onClick(event) { + console.log(event) + } + ngOnInit() { this.cities = [ { name: 'New York', code: 'NY' },