oferh / ng2-completer

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

Results from remote source not shown when search string contains whitespace #384

Open janoskaz opened 6 years ago

janoskaz commented 6 years ago

ng2-completer does not show data from remote source, when search string contains whitespaces.

For example if my search string is "v nad v", the server returns this aray of objects:

[ { "obec": "Velká nad Veličkou [HO]", "kodcobe": 17858, "latitude": 48.882574814030896, "longitude": 17.5205920753957 }, { "obec": "Vrané nad Vltavou [PZ]", "kodcobe": 18531, "latitude": 49.9359315746974, "longitude": 14.3771236031672 } ]

But completer tells me that "No results found". If, however, I search for string without whitespaces, correct results are displayed.

My html:

`<ng2-completer

cobeCompleter

                name="autocompleterCOBE"
                [dataService]="cobeRemoteData"
                [minSearchLength]="3"
                [placeholder]=""
                (selected)="onCOBESelected($event)"
                [inputClass]="'form-control'"
                [textSearching]=""
                [disableInput]="model.Foreign"
                [(ngModel)]="autocompleterText"
                required>

`

speggos commented 6 years ago

I am having the same issue. My dataSource has results, although if I type a space the results are not displayed. Has anybody found a solution to this?