1

is there any way to compare strings starting from first char (not comparing chars inside a existing string.

example: I have array with "Boobo", "Frodo", "Ookami" "Waki", "Konsta", "Perrys", "Ami". And when i have default search filter, after typing "O" in input i will get Boobo, Frodo, Ookami, Konsta because they have "o" letter inside. What i want is to get only Ookami, because this name starts with "o", after typing. Strict comparison isn`t a solution, because i would have to type whole name to get it showed.

1 Answer 1

1

You can use a custom filter: startswith angular filter

This allows you to say:

<li ng-repeat="thing in things | startsWith: search">{{thing}}</li> 

instead of

<li ng-repeat="thing in things | filter: search">{{thing}}</li> 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.