New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
runGuardsAndResolvers documentation doesn’t clearly describe when it’s used #46001
Comments
I was able to do what I need with resolvers, but it seems extremally hacky to do it this way because a resolver is not a route guard. T_T |
Ah and if it helps narrow this down. This is how my route looked before the resolver fix:
UnsavedDataGuard returns a Promise<boolean> and RequiredDataGuard returns a boolean. All my routes are lazy loaded and they work fine as far as I can tell. |
This is an issue with the documentation. RunGuardsAndResolvers only applies when the navigation doesn’t change the activated route. Probably would have been better named “rerunGuardsAndResolvers”. That is, it applies only when they would otherwise not be run because the route isn’t being activated or deactivated. |
@atscott Hi, the documentation for |
@najmiehsa Documentation is generated from the JSDoc comments here and here |
@atscott Thank you. |
Which @angular/* package(s) are the source of the bug?
router
Is this a regression?
No
Description
The Documentation suggests that you can supply a function to runGuardsAndResolvers . The link will take you to the documentation where it gives the type.
So I supplied the following and saw that not only was my route guard still being run, but the console log was not output.
It seems something is not working as described in the documentation. So either it's a bug or the documentation is misleading?
Please provide a link to a minimal reproduction of the bug
I don't have time to do this. I'll figure out another solution if needed.
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run
ng version
)Anything else?
I have seen runGuardsAndResolvers work in an older version of angular, but it was about a year and a half ago since I implemented that and it was for a different website.
The text was updated successfully, but these errors were encountered: