Angular 2+

Angular 2+ Page title

How can you change the title of the page

changing the page title

1. First we need to provide Title service.
2. Using setTitle

import {Title} from "@angular/platform-browser";
@Component({
 selector: 'app',
 templateUrl: './app.component.html',
 providers : [Title]
})
export class AppComponent implements {
 constructor( private title: Title) {
 this.title.setTitle('page title changed');
 }
}

Source
Angular 2+ Notes for Professionals book

Ahmed Mohamed Abd ElMajeed

Web developer and Server Administrator, Founder of Akwad web School and Programmer Notes.

Leave a Reply

Your email address will not be published. Required fields are marked *

Close

Adblock Detected

Please consider supporting us by disabling your ad blocker