0

I am trying to do a autocomplete with typeahead that match exact characters like t will match but not T. But I cannot get it to work as I want.

Have tried to find a solution in google and stackoverflow like: AngularJs UI typeahead match on leading characters AngularJS Filter Exact Match

This is how my example code looks like: http://plnkr.co/edit/mXthLrqNqpCyRYmj2qmT?p=preview

Thanks for helping.

Best Regards, Johnny

2
  • Be more specificly. What exactly is going wrong? Commented Nov 1, 2013 at 12:50
  • i guess he has misspelled 'not' with 'now' in first line Commented Nov 1, 2013 at 12:54

1 Answer 1

4

Are you looking for this SEE HERE

actually you were comparing by lower case hence it fetched you result in case of 't' and 'T' both

 $scope.startsWith = function(state, viewValue) {
          return state.substr(0, viewValue.length) == viewValue;
        }

fetching records for T but not for t

Sign up to request clarification or add additional context in comments.

3 Comments

I yes I am looking for something like that, but in that example they are using a simple array. I have a array of objects.
can you now see my plunker once more i have update it
Thanks for helping me, I think that I found what was wrong with my code. I have tried this before I ask for help "return state.substr(0, viewValue.length) == viewValue;" with filter|$viewValue:startsWith. In my solution I am using angularjs version 1.0.7 with bootstrap 0.6.0. It seems that they don't play with each other so well. When I changed to angularjs version 1.1.5, everything works fine then. You can test your plunk with a stable release like 1.0.8 and you will see what's happen.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.