Skip to content
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

Fix #124: dropdown outside #166

Merged
merged 1 commit into from
Feb 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion components/dropdown.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import {Dropdown} from './dropdown/dropdown.directive';
import {DropdownMenu} from './dropdown/dropdown-menu.directive';
import {DropdownToggle} from './dropdown/dropdown-toggle.directive';

export {Dropdown} from './dropdown/dropdown.directive';
export {DropdownMenu} from './dropdown/dropdown-menu.directive';
export {DropdownToggle} from './dropdown/dropdown-toggle.directive';
export const DROPDOWN_DIRECTIVES: Array<any> = [Dropdown, DropdownToggle];
export const DROPDOWN_DIRECTIVES: Array<any> = [Dropdown, DropdownToggle, DropdownMenu];
16 changes: 16 additions & 0 deletions components/dropdown/dropdown-menu.directive.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import {
Directive, ElementRef, Host,
OnInit
} from 'angular2/core';

import {Dropdown} from './dropdown.directive';

@Directive({ selector: '[dropdownMenu]' })
export class DropdownMenu implements OnInit {
constructor( @Host() public dropdown: Dropdown, public el: ElementRef) {
}

public ngOnInit() {
this.dropdown.dropDownMenu = this;
}
}
2 changes: 1 addition & 1 deletion components/dropdown/dropdown.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class DropdownService {

if (event && this.openScope.autoClose === OUTSIDECLICK &&
this.openScope.menuEl &&
this.openScope.menuEl.nativeElement === event.target) {
this.openScope.menuEl.nativeElement.contains(event.target)) {
return;
}

Expand Down