<div class="d-inline-flex position-relative" id="typeahead-container">
<input
type="text" id="search-video" name="search-video" #searchVideo i18n-placeholder placeholder="Search videos, channels…"
- [(ngModel)]="search" (ngModelChange)="onSearchChange()" (keyup)="handleKeyUp($event)"
+ [(ngModel)]="search" (ngModelChange)="onSearchChange()" (keyup)="handleKey($event)" (keydown.enter)="doSearch()"
>
<span class="icon icon-search" (click)="doSearch()"></span>
)
}
- handleKeyUp (event: KeyboardEvent) {
+ handleKey (event: KeyboardEvent) {
event.stopImmediatePropagation()
if (!this.keyboardEventsManager) return
case 'ArrowUp':
this.keyboardEventsManager.onKeydown(event)
break
- case 'Enter':
- this.newSearch = false
- this.doSearch()
- break
}
}
doSearch () {
+ this.newSearch = false
const queryParams: Params = {}
if (window.location.pathname === '/search' && this.route.snapshot.queryParams) {