change event fires multiple times when using custom search input field
See original GitHub issueDescribe the bug When using a custom search input field with ng-header-tmp, there is an issue with the change event firing multiple times and its payload being incorrect, sometimes holding an event object instead of the current model.
Reproducible example Stackblitz example
Note that this stackblitz is a minimally edited version of this example from the demos. It has only been changed to input a (change)
event monitor.
To Reproduce
- Navigate to the stackblitz example.
- Open the console to see messages printed there.
- Open the ng-dropdown
- Type in some characters to filter the list. For example,
kau
- Click on an item to select it. Note that multiple change messages print to the console, and one of them is an event object itself
Note that this issue doesn’t happen when using the native search functionality given by [searchable]
.
Note that a similar problem occurs with deselecting when [multiple]
is true.
Expected behavior There should only be one change event.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: OSX 10.12.6
- Browser: chrome 75.0.3770.142 (Official Build) (64-bit), firefox 68.0.1 (64-bit)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:7 (2 by maintainers)
same for me, it is still triggering twice even after $event.stopPropagation() is added. What I did to overcome this issue is to validate with $event.
I’ve had a simular issue. It turned out to not be an issue with ng-select.
When creating a new (test) function in my *.ts file I then added a console.log(event). This turned out to be triggered only once. The issue was in my following code which also edited the value.