Bootstrap-select not select correct element

I am using bootstrap select Bootstrap-select v1.7.2 in Angular. When I select any option from the dropdown, it selects another option.

Plunker is installed here:

http://plnkr.co/edit/MRYOkW?p=preview

(the code is in dashboard.html and dashboard.js)

This is how I create it. bootstrap-dropdown is the directive that will initiate the dropdown.

<select ng-model="vm.CurrCustomer.Logic" name="ddlLogic"   bootstrap-dropdown >
    <option>Contains</option>
    <option>Greater Than</option>
    <option>Less Than</option>
    <option>Equal To</option>
</select>

      

+3


source to share


3 answers


You missed to add a value attribute to your options that set the value ng-model

when any option was selected

<select ng-model="vm.CurrCustomer.Logic" name="ddlLogic" bootstrap-dropdown>
    <option value="">Contains</option>
    <option value="Greater">Greater Than</option>
    <option value="Less">Less Than</option>
    <option value="Equal">Equal To</option>
</select>

      

Update



If you want to dynamically display a selection option, I would call you that support selection perfectly. You can select an object when choosing an option ng-options

Demo here

+3


source


The problem is that you cannot add a parameter value property. either set a property value or generate it using the ng-repeat parameter



0


source


The above answer should be the correct answer, but it looks like you had an unwanted empty option and was messing with the index. By adding a real one, it started working.

<select ng-model="vm.CurrCustomer.Logic" name="ddlLogic"   bootstrap-dropdown >
        <option></option>
        <option>Contains</option>
        <option>Greater Than</option>
        <option>Less Than</option>
        <option>Equal To</option>
</select>

      

0


source







All Articles