I have an inssue with searching of an item in a list while the list is combined with numbers and strings while numbers are at the start.
for example. I have a list of a type code – value:
[{code: 1111, value: oneoneone}
{code: 2222, value: twotwotwo}
{code: 3333, value: threethree}
{code: 4444, value: fourfourfour}]
List looks like this:
1111 - oneoneone
2222 - twotwotwo
3333 - threethree
code example:
<select> class="myClass"
name="codeValueList"
[(ngModel)]="selectedItem"
(ngModelChange)="updateOnProcess($event)"
<option> [ngValue]="null"></option>
<option> *ngFor="let item of codeValueList" [ngValue]="s">{s.code + s.value}</option>
now while list might be really long I would like to search name by keyboard,
however since numbers start first It only searches by numbers.
is there a way to ignore search by number and only search by string using selected tag?
I tried using dataList however it doesnt work properly with an object of code value.
thanks
2
Answers
Did you set these numbers or is it something that autoincrements? Because you could turn these numbers into strings and then you would use the dataList, I believe there is no need for them to be ints or floats.
If you can use JavaScript, here is an example filter using Html, CSS and JavaScript
HTLM:
CSS:
JavaScript: