Skip to content

Commit

Permalink
feat(docs): set title per tab
Browse files Browse the repository at this point in the history
  • Loading branch information
nnixaa committed Jun 20, 2018
1 parent ac0f668 commit 09d71c9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,22 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
<ngd-prop-block *ngIf="inputs.length > 0"
[properties]="inputs"
name="Inputs"
[slag]="slag">
[slag]="slag"
class="widget-block">
</ngd-prop-block>
<ngd-prop-block *ngIf="outputs.length > 0"
[properties]="outputs"
name="Outputs"
[slag]="slag">
[slag]="slag"
class="widget-block">
</ngd-prop-block>
<ngd-prop-block *ngIf="props.length > 0"
[properties]="props"
name="Properties"
[slag]="slag">
[slag]="slag"
class="widget-block">
</ngd-prop-block>
`,
changeDetection: ChangeDetectionStrategy.OnPush,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnDestroy } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { Title } from '@angular/platform-browser';
import { BehaviorSubject, combineLatest } from 'rxjs';
import { filter } from 'rxjs/operators';
import { NgdTabbedService } from '../../../@theme/services';
Expand Down Expand Up @@ -39,6 +40,7 @@ export class NgdTabbedBlockComponent implements OnDestroy {
constructor(private activatedRoute: ActivatedRoute,
private router: Router,
private cd: ChangeDetectorRef,
private titleService: Title,
private tabbedService: NgdTabbedService) {

combineLatest([
Expand All @@ -55,6 +57,9 @@ export class NgdTabbedBlockComponent implements OnDestroy {
])
.subscribe(([params, tabs]) => {
this.currentTab = tabs.find(tab => tab.tab === params.tab);
if (this.currentTab) {
this.titleService.setTitle(`${this.titleService.getTitle()} - component ${this.currentTab.tab}`);
}
this.cd.detectChanges();
});
}
Expand Down

0 comments on commit 09d71c9

Please sign in to comment.