Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Page title is not correctly updated (#296) #328

Merged
merged 5 commits into from
Dec 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/app/pages/component-category-list/component-category-list.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Component, NgModule, OnInit} from '@angular/core';
import {Component, NgModule, OnDestroy, OnInit} from '@angular/core';
import {MatCardModule} from '@angular/material';
import {CommonModule} from '@angular/common';
import {ActivatedRoute, Params, RouterModule} from '@angular/router';
Expand All @@ -7,15 +7,17 @@ import {ComponentPageTitle} from '../page-title/page-title';
import {SvgViewerModule} from '../../shared/svg-viewer/svg-viewer';
import {Observable} from 'rxjs/Observable';
import 'rxjs/add/observable/combineLatest';
import {Subscription} from 'rxjs/Subscription';


@Component({
selector: 'app-component-category-list',
templateUrl: './component-category-list.html',
styleUrls: ['./component-category-list.scss']
})
export class ComponentCategoryList implements OnInit {
export class ComponentCategoryList implements OnInit, OnDestroy {
params: Observable<Params>;
routeParamSubscription: Subscription;

constructor(public docItems: DocumentationItems,
public _componentPageTitle: ComponentPageTitle,
Expand All @@ -26,6 +28,16 @@ export class ComponentCategoryList implements OnInit {
this.params = Observable.combineLatest(
this._route.pathFromRoot.map(route => route.params),
Object.assign);

// title on topbar navigation
this.routeParamSubscription = this.params.subscribe(params => {
const sectionName = params['section'];
this._componentPageTitle.title = SECTIONS[sectionName];
});
}

ngOnDestroy() {
this.routeParamSubscription.unsubscribe();
}
}

Expand Down
1 change: 1 addition & 0 deletions src/app/pages/component-sidenav/component-sidenav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export class ComponentSidenav implements OnInit {
this.sidenav.close();
}
});

// Combine params from all of the path into a single object.
this.params = Observable.combineLatest(
this._route.pathFromRoot.map(route => route.params),
Expand Down