Skip to content

onSameUrlNavigation doesn't re-load routed components #21115

@TylerDev6

Description

@TylerDev6

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[x ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

I'm trying to use the new onSameUrlNavigation flag in 5.1.1, and while it does repeat the RouterEvent cycle, it doesn't trigger any lifecycle events in the routed components

Expected behavior

ideally if it's going to trigger a reload, it should re-initialize any routed components.

Minimal reproduction of the problem with instructions

imports: [RouterModule.forRoot([
{ path: "", component: HomeComponent, pathMatch: "full" },
{ path: "login", component: LoginComponent },
], { onSameUrlNavigation: "reload" })]

This configuration will not trigger lifecycle events in LoginComponent if there's a link to LoginComponent somewhere on the page

What is the motivation / use case for changing the behavior?

This flag was added to support refresh, but developers would still have to listen to the router event cycle to be able to refresh any components this way

Environment


Angular version: 5.1.1


Browser:
- [x ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ x] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ x] IE version XX
- [ ] Edge version XX
 
For Tooling issues:
- Node version: XX  
- Platform:  

Others:

Metadata

Metadata

Assignees

Labels

P4A relatively minor issue that is not relevant to core functionsarea: routerfeatureIssue that requests a new featurefeature: under considerationFeature request for which voting has completed and the request is now under considerationfreq3: high

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions