How to set page title dynamically in Angular | Angular | Learn Smart Coding

Veröffentlicht am: 21 April 2022
auf dem Kanal: Learn Smart Coding
3,242
46

Hi Friends, This video is all about how to set page titles dynamically on each page in Angular. It is a simple approach to setting the page title.

In your component, just import Title
import { Title } from '@angular/platform-browser';

Inject Title in the constructor like this "private titleService: Title"

inside ngOnInit() or in any other method whichever is appropriate, use the "setTitle" method to set the title.

this.titleService.setTitle('your title content goes here');

Please post your questions in the comment section and I will be happy to answer your questions.

Subscribe for more useful videos just like this:    / @learnsmartcoding  

Happy coding!


Auf dieser Seite können Sie das Online-Video How to set page title dynamically in Angular | Angular | Learn Smart Coding mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Learn Smart Coding 21 April 2022 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 3,242 Mal angesehen und es wurde von 46 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!