根据下拉值禁用指令

时间:2017-03-08 20:10:01

标签: html angularjs angularjs-directive

我想根据其他下拉列表的选择禁用多选下拉指令。 这是第一次下拉

    <div class="col-md-2 col-sm-2">
                                <label for="labelState">State</label>
                                <select id="zone" class="form-control btn btn-default"
                                        ng-disabled="!states"
                                        ng-model="currentState"
                                        ng-options="state as state for state in states"></select>
                            </div>

这是多选下拉列表。

              `<div class="col-md-2 col-sm-2">
                                <div ng-controller="AppCtrl">
                                    <label for="ratingState">State</label>
                                    <div ng-dropdown-multiselect=""
                                         ng-disabled="currentState === 'Select State'"
                                         options="example14data"
                                         selected-model="example14model"
                                         checkboxes="true"
                                         extra-settings="example14settings">
                                    </div>                                       
                                </div>
                            </div>`

当我尝试基于第一个下拉选项禁用简单按钮时,它工作正常,但同样的事情不适用于多选下拉指令。

                                  <input type="button" 
                                   ng-disabled="currentState === 'Select State'"                                      
                                   class="btn btn-primary btn-md" />

1 个答案:

答案 0 :(得分:0)

使用angularjs-dropdown-multiselect,要禁用下拉菜单,您必须使用禁用而非禁用ng。

<div class="col-md-2 col-sm-2">
  <div ng-controller="AppCtrl">
    <label for="ratingState">State</label>
    <div ng-dropdown-multiselect=""
         disabled="currentState === 'Select State'"
         options="example14data"
         selected-model="example14model"
         checkboxes="true"
         extra-settings="example14settings">
    </div>
  </div>
</div>
相关问题