'Hidden parameter for certain users in angular
I have a path https:xxxyxxxxxx.com/mypolicy in angular ,This link is applicable for certain users,But when i am giving this url for those users.I need to hide mypolicy parameter ie, https:xxxyxxxxxx.com is needed when giving to users.(mypolicy as a hidden parameter)only that possible with angular 9.If possible please tell me how it will achieve?
Solution 1:[1]
Like @Mishna said said, redirect xxxxx.com to xxxxx.com/mypolicy
.
So instead of routing path use navigateByUrl
and move user to that url when arriving on xxxxx.com
(or some other trigger when it's time to navigate) you do:
this.router.navigateByUrl("/mypolicy", { skipLocationChange: true }).then(() => {
console.log('user has been navigated to /mypolicy')
});
In the url the user will still see xxxxx.com
as their location. skipLocationChange
set to true is what hides change in browser url.
The downside is, you can't route to xxxxx.com/mypolicy
directly.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |