1

Below is my code. Selected text from dropdown is displaying beside input text.

How can I display that inside input text. This is because "holdOrder.CenterName" is out side beside input text

 <input type="text" class="btn btn-primary dropdown-toggle" ng-disabled="disabled" style="margin-top: 5px;" /> {{holdOrder.CenterName}} <ul class="dropdown-menu" role="menu"> <li ng-repeat="svCenter in holdOrder.Centers"> <a href="" ng-click="setSelectedSC(svCenter)">{{svCenter.Fullname}}</a> </li> </ul> 
1
  • Have you heard about ngModel
    – harishr
    CommentedSep 11, 2014 at 18:05

1 Answer 1

2

You can bind input field with holdOrder.CenterName using ng-model

 <input type="text" ng-model="holdOrder.CenterName" class="btn btn-primary dropdown-toggle" ng-disabled="disabled" style="margin-top: 5px;" /> <ul class="dropdown-menu" role="menu"> <li ng-repeat="svCenter in holdOrder.Centers"> <a href="" ng-click="setSelectedSC(svCenter)">{{svCenter.Fullname}}</a> </li> </ul> 
4
  • Thanks for the input. I have a question which is extension to this. I want to use typeahead in that input text and filter in the model. How can I do this ?CommentedSep 11, 2014 at 18:26
  • I know that. My question is how to filter in controller ?CommentedSep 11, 2014 at 19:01
  • Can you elaborate more on what you want to achieve with an example if possible, probably in another post.CommentedSep 11, 2014 at 19:04
  • Here is what I did. This is the basic one and it is working. My question is, in the below link, how to replace states with my model plnkr.co/edit/SjASFL8BkKdjLRxUlGVA?p=previewCommentedSep 11, 2014 at 19:11

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.