Issue 1:
I'm submitting a ... (check one with "x")

[ ] bug report => search github for a similar issue or PR before submitting
[x] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

In a resolve, we are able to get the data from resolves on the parents, but not from the same level, so we need to do:

[
{
canActivate: [PlannerForGuard],
canActivateChild: [PlannerForGuard],
children: [
{
canActivateChild: [PlannerForGuard],
children: [
{
canActivate: [RedirectToLastRunGuard],
canActivateChild: [PlannerForGuard],
children: [
{
component: RunsComponent,
path: 'runs/:runId',
resolve: {
deleteRun: DeleteRunResolve,
run: RunResolve
}
},
{
canActivate: [RedirectToLastRunGuard],
component: RunsComponent,
path: 'runs'
}
],
component: SimulationComponent,
path: '',
resolve: {
createRun: CreateRunResolve,
createSimulation: CreateSimulationResolve,
deleteSimulation: DeleteSimulationResolve
}
}
],
path: '',
resolve: {
runs: RunsResolve
}
}
],
path: '',
resolve: {
simulation: SimulationResolve
}
}
]

Expected behavior

This could be so much simplified if resolves/guards can 'wait' for other resolves/guards on the same level, like this (it will also make for less guard checks....):

[
{
canActivate: [PlannerForGuard, RedirectToLastRunGuard],
canActivateChild: [PlannerForGuard],
children: [
{
component: RunsComponent,
path: 'runs/:runId',
resolve: {
deleteRun: DeleteRunResolve,
run: RunResolve
}
},
{
canActivate: [RedirectToLastRunGuard],
component: RunsComponent,
path: 'runs'
}
],
component: SimulationComponent,
path: '',
resolve: {
createRun: CreateRunResolve,
createSimulation: CreateSimulationResolve,
deleteSimulation: DeleteSimulationResolve,
runs: RunsResolve,
simulation: SimulationResolve
}
}
]

What is the motivation / use case for changing the behavior?

It would allow for less, clearer code + less runs of guards + speed up resolving resolves (as it's now done per level) + no more .parent.parent..... to get the parent resolves (or a custom function to search for a resolve by name ;))

Issue 2:
This is a copy of #21702 which has been locked due to inactivity. Still it is relevant.

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. AuthGuard returns a token that needs to be used within GetAppData. Currently GetAppData runs immediatly without having a token.

Workaround

Kinda ugly and confusing workaround:

{
path: '',
canActivate: [
AuthGuard,
],
children: [
{
path: '',
canActivate: [
DetectLanguage,
],
children: [
{
path: '',
canActivate: [
GetAppdata,
],
component: MyComponent,
}
}
]
}