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

Implement the canonical isOpenChange event to allow two-way binding on isOpen #167

Merged
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
2 changes: 2 additions & 0 deletions components/dropdown/dropdown.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class Dropdown implements OnInit, OnDestroy {
@Input() public appendToBody:boolean;

@Output() public onToggle:EventEmitter<boolean> = new EventEmitter();
@Output() public isOpenChange:EventEmitter<boolean> = new EventEmitter();
@HostBinding('class.dropdown') private addClass = true;

private _isOpen:boolean;
Expand Down Expand Up @@ -52,6 +53,7 @@ export class Dropdown implements OnInit, OnDestroy {
this.selectedOption = null;
}
this.onToggle.emit(this.isOpen);
this.isOpenChange.emit(this.isOpen);
// todo: implement call to setIsOpen if set and function
}

Expand Down
2 changes: 1 addition & 1 deletion demo/components/dropdown/dropdown-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</span>

<!-- Single button -->
<div class="btn-group" dropdown [isOpen]="status.isopen">
<div class="btn-group" dropdown [(isOpen)]="status.isopen">
<button id="single-button" type="button" class="btn btn-primary" dropdownToggle [disabled]="disabled">
Button dropdown <span class="caret"></span>
</button>
Expand Down