Home > Mobile >  How can I change the input received by clicking in a datalist?
How can I change the input received by clicking in a datalist?

Time:10-17

I have a datalist that shows the autocompletion of some fields how can I make sure that the input is only a part of that selected field??

CodePudding user response:

You can solve this problem by defining a variable of type number. After selecting from the input, add a number to the variable and using ngIf in html or if in ts, Control the number of choices.

CodePudding user response:

I assume that you have Street Names in the dropdown and that object also includes street information as well (maybe in some other variable). So you want user to search using the street information as well but in the dropdown you just want to show the user Street names? if that's the case, you can do something like this:

    <datalist>
    <option>
    {{streetName}} <span style="display:none">{{streetInfo}}</span>
    </option>
   </datalist>

This way your street information wont be shown but will filter the result on basis of stretInfo as well. hope it helps.

  • Related