For my mobile version I need to have different header title for every page, I can do that using header service and set title in each of my component, I also can listen to url changes in my header component and set up title depends on url, but I don't like it. What I really wanna do is to set title in my route definition like this
const mobileRoutes: Routes = [
{ path: 'login', data: { title: 'login' }, loadChildren: '../mobile/login/login.module#LoginModule' },
];
I get this idea from this article about preloading modules https://vsavkin.com/angular-router-preloading-modules-ba3c75e424cb, but I can't get it work for route changes. 2 problems: 1) if I subscribe to route.data, there is no data['title'] (however it works for PreloadingStrategy)
this.route.data.subscribe(data => {
console.log(data);
});
2) I don't know how to subscribe to route change in the way to get route object and not events. Is it even possible?