- this.router.events
- .pipe(filter(e => e instanceof NavigationEnd))
- .subscribe((event: NavigationEnd) => {
- this.hasChannel = event.url.startsWith('/videos/watch')
- this.inChannel = event.url.startsWith('/video-channels')
- this.computeResults()
- })
-
- this.router.events
- .pipe(
- filter(e => e instanceof NavigationEnd),
- map(() => getParameterByName('search', window.location.href))
- )
- .subscribe(searchQuery => this.searchInput.value = searchQuery || '')
-
+ this.route.queryParams
+ .pipe(first(params => this.isOnSearch() && params.search !== undefined && params.search !== null))
+ .subscribe(params => this.search = params.search)