0

I have a dropdown menu/textbox which is used for when users are typing in something to save. Also, if it is saved it will load on the page here as well.

            <tbody data-ng-repeat="(wholesalerIndex,wholesaler) in wholesalers" >
                <tr >
                    <td >
                        <label class="control-label">{{wholesaler.ORDER}}</label>
                       </td>
                    <td class="col-md-3">
                        <div>
                            <input type="text" class="form-control dropdown-toggle" data-toggle="dropdown" data-ng-disabled="formReadOnly" data-ng-model="wholesaler.WHSLE_NAME" data-ng-keyup="comboWholesalerBoxOptions(wholesaler.WHSLE_NAME, 'wholeSalerNameOptions')" />
                            <ul>
                                <li data-ng-repeat="wholeSalerOption in wholeSalerNameOptions | unique: 'NAME'" style="width:100%"><a data-ng-click="changeWholesalerData(wholeSalerOption, wholesaler)">{{wholeSalerOption.NAME}}</a></li>
                            </ul>
                        </div>
                    </td>
                    <td >
                        <button data-ng-click="upWholesaler(wholesaler)">Up</button>
                        <button data-ng-click="downWholesaler(wholesaler)">Down</button>
                    </td>
                </tr>
            </tbody>

There is an order of these rows being created below and it can be moved up or down. {{wholesaler.ORDER}} is the current order of the row. I want the input dropdown to be populated with {{wholesaler.NAME}} when a button is pressed.

I can't figure out how to get it to populate. Putting it next to {{wholeSalerOption.NAME}} just makes the name add onto the end of the dropdown search results. value="wholeSalerOption.NAME" also doesn't do anything.

How do I get this field to update like other ones without interfering with its ability to do it's search?

5
  • try following this link to a similar situation stackoverflow.com/questions/15688313/… Commented Apr 27, 2017 at 17:27
  • That's not similar. The JSON is all working fine here. Commented Apr 27, 2017 at 17:32
  • It's not clear to me what you are asking. When you say you "want the input dropdown to be populated" what does that mean? It appears that your "input dropdown" is currently being populated with {{wholeSalerOption.NAME}} . Can you not just change it to be {{wholesaler.NAME}} Commented Apr 27, 2017 at 17:35
  • @Scott Yes, it is when there is a search on the field. But when the button is pressed it needs to populated with {{wholesaler.NAME}}. Changing it to that is exactly what I'm trying to do. Commented Apr 27, 2017 at 17:43
  • So I'm still not certain what you are trying to do, but based on this line data-ng-model="wholesaler.WHSLE_NAME" can you not just set "wholesaler.WHSLE_NAME=THE_NEW_VALUE" when a button is clicked? Or just changed that to be "wholesaler.NAME" instead of "WHSLE_NAME". Or just have that ng-model point to some other variable that you simply set when the button is clicked. Commented Apr 27, 2017 at 17:52

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.