refreshing page doesn't set the title or description that's defined in the router
See original GitHub issueI’m submitting a … (check one with “x”)
[x] bug report => check the README and search github for a similar issue or PR before submitting
[ ] support request => check the README and search github for a similar issue or PR before submitting
[ ] feature request
Current behavior If I go from page 1 to page 2, the metas are set correctly, but if I go from page 1 to page 2 and then refresh on page 2, page 2’s metas aren’t being set.
Expected/desired behavior I expect the page 2’s metas to be set on refresh as well.
Minimal reproduction of the problem with instructions See current behavior.
-
Angular version: 2.0.X 2.3.1
-
Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ] all
-
Language: [all | TypeScript X.X | ES6/7 | ES5] all
-
Node (for AoT issues):
node --version
=
6.7
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
angular2 rc1 default route issue when refresh page
UPDATE TO RC5 Show activity on this post. One way to define a default routes with the new RC router is @Routes([ {...
Read more >Angular 14 Router - Updating the Page Title (2022) - YouTube
Every Angular Route has a dedicated property called " title " where you can define a title or the resolver that can perform...
Read more >Setting Page Titles Natively With The Angular Router
This post shows you how to use the Angular Router's new built-in feature to for setting the page title after each successful navigation....
Read more >Dynamic Page Titles in Angular
In this post, we will go through how we can set the browser (page/document) title for the entire app and we can programmatically...
Read more >ASP.NET Core Blazor routing and navigation
Learn how to manage request routing in Blazor apps and how to use the Navigation Manager and NavLink component for navigation.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @bjornharvold, now with this repro steps I can have a better understanding about the issue, thank you for the provided information 👍
A similar topic was just discussed on #30: without
defer
argument set tofalse
,setTitle
/setTag
methods simply subscribe to theNavigationEnd
event of the router. However, the observable above gets resolved after that event.There’s a subscription bound to the event, true. But it cannot be triggered just because
NavigationEnd
event was emitted earlier. In this case, passingfalse
todefer
would execute the method immediately.I’m thinking about possibilities without listening to
NavigationEnd
event, however options are quite limited asNavigationEnd
is the only event whom we can retrieveurlAfterRedirects
property. We can’t expect further functionality from the Angular team quite soon, as they’re quite busy with the i18n stuff nowadays. However, if I can find an opportunity (there’re possibilities, yes) to make it work with the desired way, be sure I’ll get it done.On the other hand, this issue reveals the fact that I need to document the behavior of
defer
argument at the README - we can’t expect people what’s under hood at the first glance 😃So, I want to say my thanks again to @chrillewoodz @cybey and @bjornharvold for all your contributions.
Than you for the mention @fulls1z3 😉 The problem I was having was not setting it directly but like this:
My current code:
Unless I add “false, false” the title doesn’t update