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 Commented Sep 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>
Sign up to request clarification or add additional context in comments.

4 Comments

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 ?
I know that. My question is how to filter in controller ?
Can you elaborate more on what you want to achieve with an example if possible, probably in another post.
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=preview

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.