In angular 1. * I used ui-router and was able to pass the NON URL Parameters from one state to another. By NON URL Parameter, I mean passing some parameters that are NOT displayed in the URL (so completely transparent to the user).
The way to do this in angular 1. * was by defining that state (stateToRedirect is a non-url parameter)
$stateProvider .state('LOGIN_STATE', { url: `login`, component: 'login', params: { stateToRedirect: 'home' } });
And changing the state as follows:
$state.go('LOGIN_STATE', { stateToRedirect: 'OTHER_STATE', });
On LOGIN_STATE, I was able to access this parameter:
$stateParams.stateToRedirect;
I am trying to find the same behavior for angular 2 Router, I understand that angular 2 Router has improved significantly, and we may not need to use ui-router-ng2.
So my question is: How do you reproduce the behavior described above in angular 2 Router?
This question seemed to be what I wanted, but I donβt want the parameter in the URL and the data property on the route seems good, but I canβt find the documentation on how to set it dynamically.
angular angular2-routing
Tonio
source share