各ページのcomponent.tsファイルにて、
①Titleクラスをインポート
import { Title } from '@angular/platform-browser';
②コンストラクタにて、TitleをDI(依存性の注入)する。
constructor(private title: Title) {
}
③ngOnInitにてタイトルを設定
ngOnInit() {
this.title.setTitle("タイトル1");
}
プログラム開発時のトラブルシューティングなどのメモ
各ページのcomponent.tsファイルにて、
①Titleクラスをインポート
import { Title } from '@angular/platform-browser';
②コンストラクタにて、TitleをDI(依存性の注入)する。
constructor(private title: Title) {
}
③ngOnInitにてタイトルを設定
ngOnInit() {
this.title.setTitle("タイトル1");
}