Ionic Autocomplete and Search Feature


#1

Hi,

I am looking to add basic autocomplete and search functionality on a input field.

I.e. the user can pick from autocomplete as they type or they can hit the search button try search for what they typed in.

I came across

But it doesn’t allow for normal searches, just simply to pick items from autocomplete.

Anybody know any alternatives ?


#2

@stevenfitzpatrick What do you mean by “doesn’t allow normal search”? If you are looking to implement a search auto-complete witch give you suggestion by typing, ion-autocomplete do that for you. And if you want your “hybrid autocomplete” witch also display all the result when the user click on search, I guess you have to implement this behaviour yourself, don’t expect ionic-directive to do the coffee for you, you may need to customize it at the end.


#3

Yes that’s I meant that instead of the cancel button there is also a normal search button which can search a different api on the query entered so far


#4

@stevenfitzpatrick Then I guess that you will need to implement this behaviour yourself, outside of your ion-autocomplete directive.


#5

#6

Hi @stevenfitzpatrick,

in the ion-autocomplete directive you are able to implement the items-method with the logic you need. So when the user opens the modal and nothing is typed you can return a list of selectable items and when he types something you can filter according to that or even add more items based on the entered text. So it is completely up to you what will be shown in the list of items.

Please have a look at the https://github.com/guylabs/ion-autocomplete#the-items-method and the https://github.com/guylabs/ion-autocomplete#external-model chapters. There everything is described.

If you have an issue or a question please create an issue at Github as there I can track it better than here in the forum.

Thanks and regards,

Guy