-
Notifications
You must be signed in to change notification settings - Fork 27k
Closed
Labels
Description
I'm submitting a...
[ ] Regression
[ ] Bug report
[X] Feature request
[ ] Documentation issue or request
[ ] Support request
Current behavior
When having multiple async guards(returning promise or observable) for the same path they execute at the same time:
{
path: '',
canActivate: [
AuthGuard,
DetectLanguage,
GetAppdata,
],
children: [ ... ]
}
Expected behavior
- 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. Currently it will request the App-Data immediatly without having a token.
The only solution is to use some hacky way with only one guard that executes them in sync. The feature having an array of guards is useless then.
Environment
Angular version: 5.2.x (i'm optimistic you implement this in 30minutes ;) )MickL, Karolis92, bahman616, cookatrice, glebmachine and 8 more