Prevent Browser Plugin to Navigate to Default Route in case of CANNOT_ACTIVATE Error
See original GitHub issueHello,
In my custom canActivate
function I check if a user has the rights to access a specific route.
If not then I manage to show a modal window to tell the user why he can’t do so.
The problem is that when manually changing the url in the browser then the browser plugin creates a different behaviour.
That is: on a CANNOT_ACTIVATE
error my modal is correctly open but soon after this code will run and will redirect the user to the default page (home for example).
Is there a way to disable this behaviour? Whenever a user cannot activate a route (whether or not using the browser plugin) I want the user to remain where he was originally, my custom logic will take care of showing modal and/or redirect.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Prevent routing in Angular when user manually changes url in ...
I am stuck in a issue that happens when user manually changes the route in browser tab and presses enter. This ...
Read more >Web service error codes (Microsoft Dataverse) - Power Apps
Message: Unable to activate or deactivate routing rule set record for entities (except case entity) as the feature control bit for entity ...
Read more >Modern client-side routing: the Navigation API
In this case the old navigation is abandoned in favour of the new navigation. The user clicks the 'stop' button in the browser....
Read more >Configuring and managing networking Red Hat Enterprise ...
Setting the default gateway on an existing connection using the nmcli interactive ... For further details and how to avoid this problem, see...
Read more >Allow or block apps and extensions - Chrome Enterprise and ...
Otherwise, your users can't access the Chrome Web Store to browse or install apps and extensions, including ones that you allow. By default,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@LeonardoGentile I’ll add an option to the browser plugin
thank you @troch 👍
If we don’t specify
defaultRoute
then we will not get any redirection even for not found routes, right?Instead of handling the multiple use cases (redirection on not found route, redirection on route that could not be activated, etcr) I guess that if you better document the errors listed here (ROUTE_NOT_FOUND, SAME_STATES, CANNOT_DEACTIVATE and so on) you could leave to the users (us) the logic for redirection
The second point is related to #176. It’s still not clear to me how to catch navigation error when manually changing the url when using the browser plugin. The browser plugin calls the router
navigate
method, but since we are not calling it manually we can’t pass error handlers to it.