trying to get the data from router in different component.
but its showing {}
value.
app-routing.module.ts
{
path: '',
loadChildren: './pages/pages.module#PagesModule',
},
pages-routing.module.ts
path: 'namescan',
component: NamescanComponent,
data: { title: 'Name Title' }
header.component.ts
private routeData;
constructor(public router: Router, public activatedRoute: ActivatedRoute) {
}
ngOnInit() {
this.activatedRoute.data.subscribe(data => console.log(data.title));
}
even find the smiliar question and even try to update the code but still not working Angular ActivatedRoute data returns an empty object
any idea, how to get the data value from router. TIA