You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Async guards should have the option to wait for previous guards to finish #40577
There should be an option to let them execute synchronous:
guard[i+1] should wait for guard[i] to finish
If guard[i] returns false all following guards should not execute
What is the motivation / use case for changing the behavior?
The example above has an authentication which needs to be done first before getting the app data. AuthGuard returns a token that needs to be used within GetAppData. Currently GetAppData runs immediatly without having a token.
Totally reasonable feature request. There are several requests for providing an option to modify how the router handles guards, resolvers, activation, etc. in terms of ordering and such. I don't think it makes sense to add all of these different options as things that can be turned on/off in the ExtraOptions like we do for certain features now. Instead, I hope the router can be reworked in the future to be more composable where it provides the basic building blocks (creating a target url, determining the target route, collecting guards, etc) and passes these along to the set of operations that developers can swap in and out. This would require quite a bit more design and thinking about what the Router should look like long term.
Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.
We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.
You can find more details about the feature request process in our documentation.
Closing in favor of #42953 (which links to this for tracking and discoverability). This is a good feature request and the ability to configure this type of thing without a bundle size cost to every Router user even if they don't use it would be one of the main goals there.
Activity
atscott commentedon Jan 26, 2021
Totally reasonable feature request. There are several requests for providing an option to modify how the router handles guards, resolvers, activation, etc. in terms of ordering and such. I don't think it makes sense to add all of these different options as things that can be turned on/off in the
ExtraOptionslike we do for certain features now. Instead, I hope the router can be reworked in the future to be more composable where it provides the basic building blocks (creating a target url, determining the target route, collecting guards, etc) and passes these along to the set of operations that developers can swap in and out. This would require quite a bit more design and thinking about what the Router should look like long term.sod commentedon Jan 27, 2021
You can use the
SequentialRoutingGuardServicefrom https://ng-run.com/edit/HmMVqtmmHB52knus3yjk?open=app%2Fsequential-routing-guard.service.ts from #36538 to achieve this.Just change your guards from
to
and they will run in sequence + cancel remaining guards if one returns false.
angular-robot commentedon Jun 4, 2021
Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.
Find more details about Angular's feature request process in our documentation.
angular-robot commentedon Jun 25, 2021
Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.
We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.
You can find more details about the feature request process in our documentation.
atscott commentedon Jul 23, 2021
Closing in favor of #42953 (which links to this for tracking and discoverability). This is a good feature request and the ability to configure this type of thing without a bundle size cost to every Router user even if they don't use it would be one of the main goals there.
angular-automatic-lock-bot commentedon Aug 23, 2021
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
atscott commentedon Jul 6, 2022
This will be somewhat trivial in the user-space if/when the "guards as functions" change is made.
And your route could be