Autocomplete for dropdown

Discussão em 'Angular' iniciado por sg9, Outubro 23, 2024.

  1. sg9

    sg9 Guest

    I need help with my Angular 17 project.I'm building a form using Reactive Forms and I need help with a particular input, that is, the prefix input.

    [​IMG]

    For what I've done now, if I click on the input, a dropdown will appear, where the user can select his/her own prefix:

    [​IMG]

    As you can see, with the click the input it's working. What I want to add though is an autocomplete function. For example, if the users wants to put 'Italy' as his/her prefix, in this case he/she needs to scroll down to look for Italy. What I want, is that, when he/she types +39, Italy will be the first and only option, and by clicking 'Enter', in the input will appear the selected prefix (along with the flag) and if he/she writes only '3', only the options where the '3' is in will be shown, with the 3 highlithed.

    How can I achieve this?

    PS: It would also be nice to have a keyboard navigation within the dropdown

    Continue reading...

Compartilhe esta Página