And this is my code structure:
My app.routes.ts:
import { Routes } from '@angular/router';
import { HomeComponent } from './home';
import { AboutComponent } from './about';
import { NoContentComponent } from './no-content';
import { DataResolver } from './app.resolver';
export const ROUTES: Routes = [
{ path: '', component: HomeComponent, data: { title: 'Dashboard' } },
{ path: 'home', component: HomeComponent, data: { title: 'Home' } },
{ path: 'detail', loadChildren: './+detail#DetailModule'},
{ path: '**', component: NoContentComponent },
];
And my sidenav.component.html has a pageTitle variable on the template, as follow:
<md-sidenav-container fullscreen>
<md-sidenav #sidenav mode="side" class="app-sidenav">
<menu-list #menuList></menu-list>
</md-sidenav>
<md-toolbar color="primary">
<button md-icon-button (click)="sidenav.toggle()">
<md-icon>menu</md-icon>
</button>
<div>{{ pageTitle }}</div>
</md-toolbar>
<main class="app-content">
<router-outlet></router-outlet>
</main>
</md-sidenav-container>
What I want to do is:
Grab the title from route each time a new route is fired
Place the title on the
pageTitlesidenav.component.tsvariable
Should I use a Service Events to communicate between components? What's the best and easy way to get title each time a route is fired?
Thank you in advance.
Best regards, Marcelo

