2

Below, is a simple lookup when the user starts typing...

<input type="text" data-ng-model="question_handset" list="phones" class="form-control">
<datalist id="phones">
<option  data-ng-repeat="ttl in titles" value="{{ttl}}">
</datalist>

script:

$scope.titles = [ "Comics Action" ,
                "Detective Comics" , "Superman" , "Fantastic Four" , "Amazing Spider-Man" ];

My problem is that this only matches on the first word you type.

i.e. I want it to work in a way where you could type: Comics and anything with the word "comics" is shown in the list for example: Detective Comics, Comics Action

I don't want to use jQuery, is there anything that can can be done with the current code to achieve this? Examples would be good. Thanks.

3 Answers 3

1

Have you tried Angular Bootstrap? It has a Typeahead. Here is the plunkr that is provided on their site. I just updated the static array.

enter image description here

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

Comments

1

I'm not aware of any angular libs not dependent on other frameworks that do this. But making it yourself is quite doable in angular. Have you seen this article? The hardest part is styling the content and aligning it the text box.

Comments

0

You can try the Angular module: ngTagsInput. I found that it's very powerful and convenient. And of course, completely compatible for an Angular project

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.