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(typeahead): Clicking an item does not raise the typeaheadOnSelectevent #389

Closed
Closed
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
10 changes: 8 additions & 2 deletions components/typeahead/typeahead-container.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const TEMPLATE:any = {
[Ng2BootstrapTheme.BS4]: `
<div class="dropdown-menu"
[ngStyle]="{top: top, left: left, display: display}"
style="display: block">
style="display: block"
(mouseleave)="hideMenu()">

This comment was marked as off-topic.

<a href="#"
*ngFor="#match of matches"
class="dropdown-item"
Expand All @@ -23,7 +24,8 @@ const TEMPLATE:any = {
[Ng2BootstrapTheme.BS3]: `
<ul class="dropdown-menu"
[ngStyle]="{top: top, left: left, display: display}"
style="display: block">
style="display: block"
(mouseleave)="hideMenu()">
<li *ngFor="#match of matches"
[class.active]="isActive(match)"
(mouseenter)="selectActive(match)">
Expand Down Expand Up @@ -156,4 +158,8 @@ export class TypeaheadContainer {
});
return false;
}

private hideMenu():void {
this.parent.hide();
}
}
5 changes: 0 additions & 5 deletions components/typeahead/typeahead.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,6 @@ export class Typeahead implements OnInit {
}
}

@HostListener('blur', ['$event.target'])
protected onBlur():void {
this.hide();
}

@HostListener('keydown', ['$event'])
protected onKeydown(e:KeyboardEvent):void {
// When typeahead container is visible, prevent submitting the form
Expand Down