引导选选择每一次错误的选项。 [英] bootstrap-select selects a wrong option each time.
问题描述
我使用的自举选择角度引导选V1.7.2。当我选择从下拉选项的一些下降,它选择一些其他的选择。
Plunker是安装程序的位置:
http://plnkr.co/edit/HPPlxx?p=$p$ PVIEW
(code为dashboard.html和dashboard.js)
这就是我如何创造它。引导-下拉是启动下拉的指令。
<形式的作用=形式NAME =frmVariableConfigNG提交=vm.saveChanges()>
<选择NG模型=vm.CurrCustomer.LogicNAME =ddlLogic签验证类=验证[需要]引导-下拉>
<选项NG重复=逻辑vm.LogicsVALUE ={{logic.value}}> {{logic.displayName}}< /选项>
< /选择>
<按钮式=提交级=BTN BTN-SM文本右>保存< /按钮>
< /表及GT;
您应该使用NG选项来填充选择输入的选项内容。
像这样:
<选择NG模型=vm.CurrCustomer.Logic数据-NG选项=logic.displayName在vm.Logics轨道逻辑由logic.valueNAME = ddlLogic签验证类=验证[需要]引导-下拉>
<期权价值=>选择...< /选项>
< /选择>
修改
使用以下内容:
<选择NG模型=vm.CurrCustomer.Logic数据-NG选项=logic.displayName在vm.Logics逻辑签验证类=验证[customFunc]引导-下拉>
<选项风格=显示:无VALUE =>选择< /选项>
< /选择>
其中, customFunc
是您创建检查所选择的值不是,
新的自定义验证函数。
I am using bootstrap select Bootstrap-select v1.7.2 in Angular. When I select some option from drop down it selects some other option.
Plunker is setup here:
http://plnkr.co/edit/HPPlxx?p=preview
(code is in dashboard.html and dashboard.js)
That's how I am creating it. bootstrap-dropdown is the directive that initiates the drop-down.
<form role="form" name="frmVariableConfig" ng-submit="vm.saveChanges()">
<select ng-model="vm.CurrCustomer.Logic" name="ddlLogic" check-validation class="validate[required]" bootstrap-dropdown >
<option ng-repeat="logic in vm.Logics" value="{{logic.value}}">{{logic.displayName}}</option>
</select>
<button type="submit" class="btn btn-sm text-right">Save</button>
</form>
You should use ng-options to populate the option elements of a select input.
Like so:
<select ng-model="vm.CurrCustomer.Logic" data-ng-options="logic.displayName for logic in vm.Logics track by logic.value" name="ddlLogic" check-validation class="validate[required]" bootstrap-dropdown >
<option value="">Select...</option>
</select>
EDIT
Use the following:
<select ng-model="vm.CurrCustomer.Logic" data-ng-options="logic.displayName for logic in vm.Logics" check-validation class="validate[customFunc]" bootstrap-dropdown>
<option style="display:none" value="">Select</option>
</select>
where customFunc
is a new custom validation function you create to check that the selected value is not ""
.
这篇关于引导选选择每一次错误的选项。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!