I want to change the title of the page whenever I click or browse the link from the URL bar. How to change that using Angular route? I am using angular version 4 and angular
You can to use @angular/platefor-browser
to use the setTitle()
:
import { Title } from '@angular/platform-browser';
@Component({
selector: 'your-component',
})
export class YourComponent implements onInit {
constructor(private title: Title) {}
ngOnInit() {
this.title.setTitle('Title for this component');
}
}