Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Autocomplete does now work when result contains one unique entry. #438

Open
Snazzythat opened this issue Oct 21, 2019 · 0 comments
Open

Comments

@Snazzythat
Copy link

I use ng2-completer for the purposes of autocompleting the country field in my form. I use country code local data in the following format:

....
{ Code: 'BS', Name: 'Bahamas' },
{ Code: 'BH', Name: 'Bahrain' },
{ Code: 'BD', Name: 'Bangladesh' },
{ Code: 'BB', Name: 'Barbados' },
{ Code: 'BY', Name: 'Belarus' },
{ Code: 'BE', Name: 'Belgium' },
{ Code: 'BZ', Name: 'Belize' },
{ Code: 'BJ', Name: 'Benin' },
.....

The service call that I use the the following:

completerService.local(countryIsoCodes, 'Code,Name', 'Code').descriptionField('Name');

where the search is performed on both Code and Name fields. When I enter a country code, for instance CA, I get several results with one highlighted (Canada) as best match. However, if I enter a country code which results in one unique entry (ex: MD), that entry is not displayed:

Entering CA:
dp1

Entering MD (should search by 'Code' field and find an entry)
dp2

Entering Moldova (the search was done with 'Name' field and works properly):
dp3

This persists for other type of data where only one entry is returned. I debugged the library and the entry is actually found (but not displayed):

dp4

Can we have a fix for that?

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant