oferh / ng2-completer

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

Searching text does not disappear on first focus with OpenOnFocus option #404

Closed edubsi closed 4 years ago

edubsi commented 5 years ago

Affected Version: @next (3.0.0-beta.1)

This might be an side effect of the angular 6 migration. The component does not show the results & remove the searching text, when the dataservice returns on the first focus.

This can be reproduced with the dataservice of the first demo component by adding [openOnFocus]="true" to the component e.g:

            <ng2-completer class="completer-limit"
                           [(ngModel)]="countryName"
                           [datasource]="dataService"
                           [minSearchLength]="0"
                           [maxChars]="4"
                           [inputClass]="'form-control'"
                           [placeholder]="'Search country'"
                           [matchClass]="'match'"
                           [autofocus]="true"
                           [openOnFocus]="true"
                           [textSearching]="false">
            </ng2-completer>

The same thing happens with the [openOnClick]="true" option on the first click. If the component looses focus and regains it, everything seems to work fine.

Is it a bug or did I misuse the options above?

fravezzimattia commented 5 years ago

I've same problem on my project! First time I click on search result list is empty!

"@angular/core": "^6.0.3",
"ng2-completer": "^3.0.0-beta.1",
caioladislau commented 5 years ago

Same problem!

"@angular/core": "6.0.7",
"ng2-completer": "^3.0.0-beta.1",
ghost commented 5 years ago

Same problem.First time , it doesn't work.But works after first try. Any solutions/work arounds for this?

TechnicalDiary commented 5 years ago

Same problem.First time , it doesn't work.But works after first try. Please provide solution. Client is getting angry.

ghost commented 5 years ago

anyone has a workaround for this?

harryluo91 commented 5 years ago

i had the same issue, it looks like you can specify the minSearchLength to be >= 2 to resolve this, but I still don't understand why is this happening and how does the minSearchLength fix it.

oferh commented 5 years ago

should be fixed in 3.0.0-beta.2

edubsi commented 5 years ago

Thank you. The issue was fixed for me.

fravezzimattia commented 5 years ago

There is a problem with IE 11, When write on the input the list disappear! anybody found this problems?

The Object Not support propriety "matches"

[SOLVED] if at the end of polyfills.ts is added:

if (!Element.prototype.matches) {
Element.prototype.matches = Element.prototype.msMatchesSelector;
}

no errors are thrown.