如何prevent从关闭一个角度,自举下拉(取消事件,这是由指令的约束) [英] How to prevent an angular-bootstrap dropdown from closing (Unbind Event which was bound by a directive)
问题描述
我现在用的角引导下拉。我想从上点击关闭,直到用户关闭它故意prevent它。
I am using the Angular-Bootstrap Dropdown. I want to prevent it from closing on click until the user closes it intentionally.
默认状态是:点击某处文档时下拉关闭。
Default state is: The Dropdown closes when clicking somewhere in the Document.
我确定code的相关线路:(12线,dropdown.js)
I identified the relevant lines of code: (Line 12, dropdown.js)
this.open = function( dropdownScope ) {
if ( !openScope ) {
$document.bind('click', closeDropdown); // line to unbind
$document.bind('keydown', escapeKeyBind);
}
}
您可以在这里找到完整的code:链接Github上
You can find the full code here: Link to Github
我不希望改变角引导的原始资料,以保持我的项目开放的更新。
I don't want to change the original sources of angular-bootstrap to keep my project open for updates.
我的问题:
我怎么能拆散一个指令在角控制器绑定到文件的事件吗?
推荐答案
我解决了这个通过添加以下到我的下拉菜单。这$ P $的关闭,除非你点击打开它的标签pvents下拉
I solved this by adding the following to my drop down-menu. This prevents the drop down from closing unless you click on the tag that opens it
<ul class="dropdown-menu" ng-click="$event.stopPropagation()">
这篇关于如何prevent从关闭一个角度,自举下拉(取消事件,这是由指令的约束)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!