-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Closed
Labels
area: routerfeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issuesfeature: under considerationFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under considerationfreq3: high
Milestone
Description
I'm submitting a...
[x] Feature request
Current behavior
Currently Angular does not provide a way of passing additional data with router.navigate.
There are many use cases for this, described in related issues which were unjustly closed without fulfilment:
- Router navigate with Route Data #5217
- Passing parameters without adding them to URL #8515
- [Router 3.0.0-beta.2] "data" parameter exists in Route and unable to pass data dynamically #9804
- Router: Support Setting State Object When Navigating #10248
#10248 is not actually closed, but addresses only a part of the problem.
Expected behavior
Here is an example how it could work taken from #5217:
// exactly like @RouteConfig
this.router.navigateByUrl('/path', { data: { entity: 'entity' } })
The given data should be accessible everywhere where route.data is accessible (in the target component, resolvers if any etc.)
Environment
Angular version: from 2 up to the current.
Additional Information
There is a workaround by @hipparch:
https://github.com/Hipparch/Angular2-navigate-with-data
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: routerfeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issuesfeature: under considerationFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under considerationfreq3: high