import { Component, OnInit } from '@angular/core'; import { Observable } from 'rxjs'; import { ProductService } from 'src/app/services/product.service'; import { Product } from 'src/app/models/product'; import { Router } from '@angular/router'; @Component({ selector: 'app-page-nav-bar', templateUrl: './page-nav-bar.component.html', styleUrls: ['./page-nav-bar.component.css'] }) export class PageNavBarComponent implements OnInit { searchValue: string = ""; products : Observable constructor(private _productService : ProductService, private router: Router) { } clickme() { alert('searchValue: '+this.searchValue); this.products = this._productService.searchProduct(this.searchValue); this._productService.search = this.searchValue; // this.router.navigate(["/search", {search: this.searchValue}]); } ngOnInit(): void { } }