mempool/frontend/src/app/services/seo.service.ts

33 lines
796 B
TypeScript
Raw Normal View History

2020-03-23 18:52:08 +01:00
import { Injectable } from '@angular/core';
import { Title } from '@angular/platform-browser';
import { environment } from 'src/environments/environment';
2020-03-23 18:52:08 +01:00
@Injectable({
providedIn: 'root'
})
export class SeoService {
network = environment.network;
2020-03-23 18:52:08 +01:00
defaultTitle = 'mempool - Bitcoin Explorer';
constructor(
private titleService: Title,
) { }
setTitle(newTitle: string, prependNetwork = false) {
let networkName = '';
if (prependNetwork) {
if (this.network === 'liquid') {
networkName = 'Liquid ';
} else if (this.network === 'testnet') {
networkName = 'Testnet ';
}
}
this.titleService.setTitle(networkName + newTitle + ' - ' + this.defaultTitle);
2020-03-23 18:52:08 +01:00
}
resetTitle() {
this.titleService.setTitle(this.defaultTitle);
}
}