1 import { filter, map } from 'rxjs/operators'
2 import { Component, OnInit } from '@angular/core'
3 import { NavigationEnd, Router } from '@angular/router'
4 import { getParameterByName } from '../shared/misc/utils'
8 templateUrl: './header.component.html',
9 styleUrls: [ './header.component.scss' ]
12 export class HeaderComponent implements OnInit {
15 constructor (private router: Router) {}
20 filter(e => e instanceof NavigationEnd),
21 map(() => getParameterByName('search', window.location.href))
23 .subscribe(searchQuery => this.searchValue = searchQuery || '')
27 this.router.navigate([ '/search' ], {
28 queryParams: { search: this.searchValue }