Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Dynamic Angular Router, change state params on same route #29891
Hi everyone, I tried to follow docs and example, but I have no idea how to reload same route with different params, if you have idea what route you are in.
But basically lets say that your convention is
And you want to change appId from some global scope. So you can this.router to access current Angular Router instance, and you want to call .navigate() method and load same route but with different appId param.
Any idea, how to do such simple thing ? I am not interested in string parsing url techniques or other "hacky" ideas, thx
Hack solution looks like this:
If you look at the code you will realise that from URL i cannot really access state params by its name and I have to make hard-coded exceptions etc to change state param.
I am quite sure that has to be a method which can parse current URL with params. Then change param and pass url back to router.