首页 > 解决方案 > Angular ui-select ng-blur

问题描述

我正在使用ui-select并想ng-blur在 ui select 上使用,但我试图调用的函数ng-blur没有触发。
ng-blur不工作ui-select

<ui-select ng-blur="getdetails()" ng-model="$root.caseSearchModel.progressionDesc"
skip-focusser="true" id="current_progression_description">
    <ui-select-match>
        <span ng-bind-html="$select.selected.DESC1"></span>
    </ui-select-match>
    <ui-select-choices repeat="item.DESC2 as item in progressionDescs | filter: { DESC2: $select.search }">
        <div ng-bind-html="item.DESC1 | highlight: $select.search"></div>
    </ui-select-choices>
    <ui-select-no-choice>
        Does not match.
    </ui-select-no-choice>
</ui-select>
$scope.getdetails = function () {
    console.log("i am in blur function");
}

我想在getdetails每次用户离开时触发该功能ui-select

标签: javascriptangularjs

解决方案


使用 0.19.0 版本ui-select,您可以传递一个调用的指令uis-open-close,您可以传递一个回调,该回调在打开或关闭下拉菜单时调用。

它包含isOpen作为参数,如果下拉菜单已打开,则设置为 true,否则为 false。

https://github.com/angular-ui/ui-select/wiki/uis-open-close


推荐阅读