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">
|
<div class="d-inline-flex position-relative" id="typeahead-container">
|
||||||
<input
|
<input
|
||||||
type="text" id="search-video" name="search-video" #searchVideo i18n-placeholder placeholder="Search videos, channels…"
|
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>
|
<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()
|
event.stopImmediatePropagation()
|
||||||
if (!this.keyboardEventsManager) return
|
if (!this.keyboardEventsManager) return
|
||||||
|
|
||||||
|
@ -143,14 +143,11 @@ export class SearchTypeaheadComponent implements OnInit, OnDestroy {
|
||||||
case 'ArrowUp':
|
case 'ArrowUp':
|
||||||
this.keyboardEventsManager.onKeydown(event)
|
this.keyboardEventsManager.onKeydown(event)
|
||||||
break
|
break
|
||||||
case 'Enter':
|
|
||||||
this.newSearch = false
|
|
||||||
this.doSearch()
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
doSearch () {
|
doSearch () {
|
||||||
|
this.newSearch = false
|
||||||
const queryParams: Params = {}
|
const queryParams: Params = {}
|
||||||
|
|
||||||
if (window.location.pathname === '/search' && this.route.snapshot.queryParams) {
|
if (window.location.pathname === '/search' && this.route.snapshot.queryParams) {
|
||||||
|
|
Loading…
Reference in New Issue