angular - Why am I getting undefined route in header Only and not in other components? -
below google brand route. when in googledetailcomponent using,
this. paramssub = this.route.params.subscribe(params=> { this.searchstr = params['id']; }); i able params['id'] not in header using same above code.
// define routes const routes: routes = [ { path: 'google', component: googlecomponent, children: [ { path: 'google home', component: homecomponent }, { path: 'google pixel', component: pixelcomponent }, { path: ':id', component: googledetailcomponent }, { path: '', component: googlehomecomponent } ] } ]; below googlecomponent:
import { component, oninit } '@angular/core'; @component({ selector: 'app-google', template: `<rb-google-header></rb-google-header> <router-outlet></router-outlet>` }) export class googlecomponent implements oninit { ngoninit(){ window.scrollto(0, 0); } } when search 'google pixel', want able highlight 'google pixel' in header when in google brand: /google/google pixel. not know how highlight 'google pixel' if getting undefined route in header. in advance.

Comments
Post a Comment