Angularjs 是否以编程方式关闭所有ui选择下拉列表?

Angularjs 是否以编程方式关闭所有ui选择下拉列表?,angularjs,angular-ui-bootstrap,bootstrap-modal,angular-ui-select,Angularjs,Angular Ui Bootstrap,Bootstrap Modal,Angular Ui Select,我试图构建一个指令,使AngularUI$uibModal可拖动。我还想在模式拖动时,关闭模式主体中ui select的所有打开下拉列表 有人知道如何关闭$uibModal中的所有ui-select列表吗 杰斯宾 这是更好的方法,但您需要根据以下内容创建另一个指令: $select 然后将其添加到元素中: <ui-select my-ui-select ng-model="selected.value"> <ui-select-matc

我试图构建一个指令,使AngularUI$uibModal可拖动。我还想在模式拖动时,关闭模式主体中ui select的所有打开下拉列表

有人知道如何关闭
$uibModal
中的所有
ui-select
列表吗

杰斯宾


这是更好的方法,但您需要根据以下内容创建另一个指令:

$select

然后将其添加到元素中:

<ui-select my-ui-select ng-model="selected.value">
                    <ui-select-match>
                        <span ng-bind="$select.selected.name"></span>
                    </ui-select-match>
                    <ui-select-choices repeat="item in myModalCtrl.itemArray">
                        <span ng-bind="item.name"></span>
                    </ui-select-choices>
              </ui-select>

在此之后,仅广播事件以关闭所有内容示例:

angular.module('myApp').directive('myUiSelect', function() {
  return {
    require: 'uiSelect',
    link: function(scope, element, attrs, $select) {
      scope.$on('closeAll', (ev,val)=>{
        $select.close();
      });
    }
  };
});
<ui-select my-ui-select ng-model="selected.value">
                    <ui-select-match>
                        <span ng-bind="$select.selected.name"></span>
                    </ui-select-match>
                    <ui-select-choices repeat="item in myModalCtrl.itemArray">
                        <span ng-bind="item.name"></span>
                    </ui-select-choices>
              </ui-select>