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>
source to share
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
source to share
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>
source to share