New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Passing parameters without adding them to URL #8515
Comments
The router will have some feature parity with the deprecated router, so route data will be brought back. |
So far no news about adding |
When will it be brought back? I need it in my application. Working with deprecated-stuff is a bit weird to do in an "up to date" app. edit: I also do not want to pass this data in my url as an object, since this give other/new troubles (and I do not want a user to see all this stuff) @brandonroberts any news on this? |
@hanijizan, I think this PR #9619 fix it. |
@hirtie-maxim, Adding "data" to the routing configuration seems to be very static, so that does not solve the issue. Did I overlook something with the "resolves"? |
@sventorben if you want to pass data between routes without it showing up in the URL, you should use a service instead of route data. Route data is static with the exception of resolves that get merged into route data after completion. |
@brandonroberts Thanks for clarification. Though, I was hoping for a different answer. ;) To parahrize an analogy: This feels as if someone took the HTTP protocol and stripped POST, PUT and DELETE and left me with GET only. I am just wondering why there is no such thing as a "default resolve" which is implicitly available on every route. This would allow to pass some data when triggering navigation. That data could get automatically merged into route data after completion. |
It does feel pretty cumbersome to create a shared service just to pass an object into a route... |
What is the use of static data? I can do this in the constructor or when the component is initialized. I think that this feature should be added to "router.navigate" as a parameter. I do not understand how it has not been realized so far. For example, you can bind the state of a form to navigation. If I go back, how do I return the state of the form? I do not want to store all the form's params in the URL. How can "Share Service" help here? A snapshot of the router with my data would be very convenient. |
Did anyone figure out a way to pass data while navigating (not passing params in URL)? I definitely seem to need this in one of my cases. |
List of tickets about passing data with router.navigate:
Currently all the tickets are closed (except #10248 which addressed only a part of the problem), and the issue is still here. |
+1 |
this is a walk around , far from being perfect but it dose work.. |
See #27198 for an implementation that supports this. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
data
is removed in rc1 release fromRoute
. The remaining options currently are query strings and route parameters. Both of which visibly add values to URLs. There are many scenarios for which the user doesn't need to see passed values as part of URL, and that makes URLs user friendly while the functionality remains the same. Currently to pass an arbitrary value from one component to another without appending it to URL, a data service or a mediator is required. Either of two are an added complexity if the arbitrary value is a simple token of some sort.I suggest bringing back the
data
as well as adding an optional Boolean value torouter.navigate
which specifies if passed values are supposed to be added to URL. Iffalse
then pass them behind the scene and iftrue
do as what happens currently (query string or route param).The text was updated successfully, but these errors were encountered: