-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dropdown not work on angular2-modal #267
Labels
Comments
valorkin
changed the title
Dropdown not work on angular2-modal
Dropdown not work on angular2-modal
Mar 10, 2016
I did a temporary work around. add a rootElement to dropdown directive class Dropdown {
@Input()
public rootElement: HTMLElement;
} and pass it in host template <div class="modal-root" #modal>
<div class="btn-group" dropdown [rootElement]="modal" keyboardNav="true">...</div>
</div> and dropdown.service can binding event listener to it class DropdownService {
...
public open(dropdownScope: Dropdown) {
if (!this.openScope) {
if (dropdownScope.rootElement)
dropdownScope.rootElement.addEventListener('click', this.closeDropdownBind);
else
window.document.addEventListener('click', this.closeDropdownBind);
window.document.addEventListener('keydown', this.keybindFilterBind);
}
...
}
} have any better idea? |
I found a better way, no need to change directive interface. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am using dropdown directive with angular2-modal
found the issue that drop-down menu didn't auto close, because modal component will prevent the click event bubbling up.
so, I think the window not appropriated listenser target(in /components/dropdown/dropdown.service.ts)
window.document.addEventListener('click', this.closeDropdownBind);
is it possible to change that?
The text was updated successfully, but these errors were encountered: