Fix search after first type on input
This commit is contained in:
parent
8323c435c1
commit
be6343d26e
|
@ -1,7 +1,7 @@
|
|||
<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>
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ export class SearchTypeaheadComponent implements OnInit, OnDestroy {
|
|||
)
|
||||
}
|
||||
|
||||
handleKeyUp (event: KeyboardEvent) {
|
||||
handleKey (event: KeyboardEvent) {
|
||||
event.stopImmediatePropagation()
|
||||
if (!this.keyboardEventsManager) return
|
||||
|
||||
|
@ -143,14 +143,11 @@ export class SearchTypeaheadComponent implements OnInit, OnDestroy {
|
|||
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) {
|
||||
|
|
Loading…
Reference in New Issue