Skip to content

Instantly share code, notes, and snippets.

@Falci
Created March 1, 2017 03:16
Show Gist options
  • Save Falci/e395ddd3f977fc204e499aaa31b198ff to your computer and use it in GitHub Desktop.
Save Falci/e395ddd3f977fc204e499aaa31b198ff to your computer and use it in GitHub Desktop.
Angular2 Title utility
import {Title} from "@angular/platform-browser";
import {Injectable} from "@angular/core";
@Injectable()
export class TitleService extends Title {
private prefix: string = '';
private suffix: string = '';
setTitle(newTitle: string) {
super.setTitle(`${this.prefix} ${newTitle} ${this.suffix}`.trim());
}
setPrefix(newPrefix: string) {
this.prefix = newPrefix;
}
setSuffix(newSuffix: string) {
this.suffix = newSuffix;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment