Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- imports: [
- BrowserModule,
- RouterModule.forRoot([
- {
- path: '',
- component: HomeComponent,
- data: {
- title: 'Home'
- }
- },
- {
- path: 'about',
- component: AboutComponent,
- data: {
- title: 'About'
- }
- },
- {
- path: 'products-and-services',
- component: ProductsServicesComponent,
- data: {
- title: 'Products & Services'
- }
- },
- {
- path: 'world-class-laundry',
- component: LaundryComponent,
- data: {
- title: 'World Class Laundry'
- }
- },
- {
- path: 'contact',
- component: ContactComponent,
- data: {
- title: 'Contact'
- }
- },
- {
- path: '**',
- component: NotFoundComponent,
- data: {
- title: 'Page Not Found'
- }
- }
- ])
- ],
- ngOnInit() {
- this.router.events
- .filter((event) => event instanceof NavigationEnd)
- .map(() => this.activatedRoute)
- .map((route) => {
- while (route.firstChild) route = route.firstChild;
- return route;
- })
- .filter((route) => route.outlet === 'primary')
- .mergeMap((route) => route.data)
- .subscribe((event) => {
- this.titleService.setTitle(event['title']);
- });
- }
Add Comment
Please, Sign In to add comment