When building applications with Angular, one common thing you should do is have the page title update after each successful navigation. This helps ...
For further actions, you may consider blocking this person and/or reporting abuse
Didn't know about the new Title Strategy, thank you!
Great article! π
Great stuff! Now to convince my company to drop IE11 support so we can update :D
Thank you for the great article! π§‘π§‘
Awesome β€οΈ_β€οΈ
What about dynamic page title?
You can still do dynamic page titles
Is it possible to read the title out of the route config in a component? Want to use the TitleStrategy to append
${title} | ${companyName}
, but want to get the title in the component as well. I can see it in the snapshot data, but can't seem to access it:Hey Martin,
I was also trying to figure how to do it... It happens to be easier than I thought! :)
If you want to read this in a higher level component this is a bit tricky.
I came up with the following solution that combines router events with the
Title
service to create an observable:You could also call the
Title
service directly from your template. However, this is normally bad practice, because it would be called quite often.Great article. I had a question though. Will the 'setTitle' from the platform-browser package work for the same case if we set it the component level?
angular.io/api/platform-browser/Title
Thanks! Good question. My thought is that this would overwrite your title set at the component level because the components are activated before the navigation cycle is complete.
If you wanted to opt-out of this, you could probably set an empty
title
route property so it doesn't update the title.Thanks
It's so owesome, loved this strategy
This is very useful and awesome. Thanks
Wasn't aware of the title strategy. Thanks for sharing.
thank you :)