Search code examples
angularangular2-router

Currious 'state' query param behaviour with angular2 Router


I don't find any documentation on this precious behaviour of Angular 2 Router : if I load my app with a 'state' query param, the router automatically navigates to the given state.

I found this by chance looking for a solution to my problem, but I need to parse some other query params and here I'm loosing them.

For example : http://my.app/?state=#/screen1&anotherParam=something automatically "redirect" my application to http://my.app/#/screen1, then I'm loosing anotherParam.

Is this a undocumented feature or a bug ? Or do you see any page I missed about this behaviour ?


Solution

  • This is a known issue

    As a workaround you could add a guard that covers all routes, when the guard is called store the params in a shared service and provide them this way to interested components.