mirror of https://github.com/ghostfolio/ghostfolio
committed by
GitHub
33 changed files with 185 additions and 44 deletions
@ -0,0 +1,23 @@ |
|||||
|
import { Injectable } from '@angular/core'; |
||||
|
import { Title } from '@angular/platform-browser'; |
||||
|
import { RouterStateSnapshot, TitleStrategy } from '@angular/router'; |
||||
|
|
||||
|
@Injectable() |
||||
|
export class PageTitleStrategy extends TitleStrategy { |
||||
|
private static readonly DEFAULT_TITLE = |
||||
|
'Ghostfolio – Open Source Wealth Management Software'; |
||||
|
|
||||
|
public constructor(private readonly title: Title) { |
||||
|
super(); |
||||
|
} |
||||
|
|
||||
|
public override updateTitle(routerState: RouterStateSnapshot) { |
||||
|
const title = this.buildTitle(routerState); |
||||
|
|
||||
|
if (title) { |
||||
|
this.title.setTitle(`${title} – ${PageTitleStrategy.DEFAULT_TITLE}`); |
||||
|
} else { |
||||
|
this.title.setTitle(`${PageTitleStrategy.DEFAULT_TITLE}`); |
||||
|
} |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue