oferh / ng2-completer

Angular 2 autocomplete component
http://oferh.github.io/ng2-completer/
MIT License
348 stars 171 forks source link

Hidden 0-index row when there are no search matches, row does not unregister #460

Open fjurada opened 3 years ago

fjurada commented 3 years ago

Reproduction steps:

I have traced the issue to the ngOnDestroy method of the CtrRow directive. The IF (this_rowIndex) evaluates to false if rowIndex is 0 or undefined - preventing unregistration of the row.

The temporary fix I have made is very ugly and hacky - on one of the parent components wrapping this: @ViewChildren(CtrRow) set ctrRows(values: QueryList<CtrRow>) { values.forEach((row) => { row.ngOnDestroy = () => { row['dropdown'].unregisterRow(row['_rowIndex']); } }); }