At the moment: I'm using router.events
to fetch information from
{path: '', component: HomeComponent, data:{header:true}},
router configuration
ngOnInit() {
this.router.events.filter(e => e instanceof NavigationEnd).subscribe(event => {
console.log(this.route.firstChild.data.value.header); //fetches the correct data but also generates a type error
});
}
This method retrieves the accurate data from the router config (
this.route.firstChild.data.value.header
) but triggers the following error.
ERROR in src/app/app.component.ts(29,52): error TS2339: Property 'value' does not exist on type 'Observable<Data>'.
I believe I need to subscribe to the data in a certain way because it's an observable. However, my attempts so far have been unsuccessful