Reputation: 199
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.
Upvotes: 1
Views: 1016
Reputation: 4446
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>
Upvotes: 1