<p dir="auto"><strong>I'm submitting a ...</strong>  (check one with "x")</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[ ] bug report =&gt; search github for a similar issue or PR before submitting
[x] feature request
[ ] support request =&gt; Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question"><pre class="notranslate"><code class="notranslate">[ ] bug report =&gt; search github for a similar issue or PR before submitting
[x] feature request
[ ] support request =&gt; Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
</code></pre></div>
<p dir="auto"><strong>Current behavior</strong></p>

<p dir="auto">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:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="[
        {
            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
            }
        }
    ]"><pre class="notranslate"><span class="pl-kos">[</span>
        <span class="pl-kos">{</span>
            <span class="pl-c1">canActivate</span>: <span class="pl-kos">[</span><span class="pl-smi">PlannerForGuard</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
            <span class="pl-c1">canActivateChild</span>: <span class="pl-kos">[</span><span class="pl-smi">PlannerForGuard</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
            <span class="pl-c1">children</span>: <span class="pl-kos">[</span>
                <span class="pl-kos">{</span>
                    <span class="pl-c1">canActivateChild</span>: <span class="pl-kos">[</span><span class="pl-smi">PlannerForGuard</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
                    <span class="pl-c1">children</span>: <span class="pl-kos">[</span>
                        <span class="pl-kos">{</span>
                            <span class="pl-c1">canActivate</span>: <span class="pl-kos">[</span><span class="pl-smi">RedirectToLastRunGuard</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
                            <span class="pl-c1">canActivateChild</span>: <span class="pl-kos">[</span><span class="pl-smi">PlannerForGuard</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
                            <span class="pl-c1">children</span>: <span class="pl-kos">[</span>
                                <span class="pl-kos">{</span>
                                    <span class="pl-c1">component</span>: <span class="pl-smi">RunsComponent</span><span class="pl-kos">,</span>
                                    <span class="pl-c1">path</span>: <span class="pl-s">'runs/:runId'</span><span class="pl-kos">,</span>
                                    <span class="pl-c1">resolve</span>: <span class="pl-kos">{</span>
                                        <span class="pl-c1">deleteRun</span>: <span class="pl-smi">DeleteRunResolve</span><span class="pl-kos">,</span>
                                        <span class="pl-c1">run</span>: <span class="pl-smi">RunResolve</span>
                                    <span class="pl-kos">}</span>
                                <span class="pl-kos">}</span><span class="pl-kos">,</span>
                                <span class="pl-kos">{</span>
                                    <span class="pl-c1">canActivate</span>: <span class="pl-kos">[</span><span class="pl-smi">RedirectToLastRunGuard</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
                                    <span class="pl-c1">component</span>: <span class="pl-smi">RunsComponent</span><span class="pl-kos">,</span>
                                    <span class="pl-c1">path</span>: <span class="pl-s">'runs'</span>
                                <span class="pl-kos">}</span>
                            <span class="pl-kos">]</span><span class="pl-kos">,</span>
                            <span class="pl-c1">component</span>: <span class="pl-smi">SimulationComponent</span><span class="pl-kos">,</span>
                            <span class="pl-c1">path</span>: <span class="pl-s">''</span><span class="pl-kos">,</span>
                            <span class="pl-c1">resolve</span>: <span class="pl-kos">{</span>
                                <span class="pl-c1">createRun</span>: <span class="pl-smi">CreateRunResolve</span><span class="pl-kos">,</span>
                                <span class="pl-c1">createSimulation</span>: <span class="pl-smi">CreateSimulationResolve</span><span class="pl-kos">,</span>
                                <span class="pl-c1">deleteSimulation</span>: <span class="pl-smi">DeleteSimulationResolve</span>
                            <span class="pl-kos">}</span>
                        <span class="pl-kos">}</span>
                    <span class="pl-kos">]</span><span class="pl-kos">,</span>
                    <span class="pl-c1">path</span>: <span class="pl-s">''</span><span class="pl-kos">,</span>
                    <span class="pl-c1">resolve</span>: <span class="pl-kos">{</span>
                        <span class="pl-c1">runs</span>: <span class="pl-smi">RunsResolve</span>
                    <span class="pl-kos">}</span>
                <span class="pl-kos">}</span>
            <span class="pl-kos">]</span><span class="pl-kos">,</span>
            <span class="pl-c1">path</span>: <span class="pl-s">''</span><span class="pl-kos">,</span>
            <span class="pl-c1">resolve</span>: <span class="pl-kos">{</span>
                <span class="pl-c1">simulation</span>: <span class="pl-smi">SimulationResolve</span>
            <span class="pl-kos">}</span>
        <span class="pl-kos">}</span>
    <span class="pl-kos">]</span></pre></div>
<p dir="auto"><strong>Expected behavior</strong></p>

<p dir="auto">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....):</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="[
    {
        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
        }
    }
]"><pre class="notranslate"><span class="pl-kos">[</span>
    <span class="pl-kos">{</span>
        <span class="pl-c1">canActivate</span>: <span class="pl-kos">[</span><span class="pl-smi">PlannerForGuard</span><span class="pl-kos">,</span> <span class="pl-smi">RedirectToLastRunGuard</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
        <span class="pl-c1">canActivateChild</span>: <span class="pl-kos">[</span><span class="pl-smi">PlannerForGuard</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
        <span class="pl-c1">children</span>: <span class="pl-kos">[</span>
            <span class="pl-kos">{</span>
                <span class="pl-c1">component</span>: <span class="pl-smi">RunsComponent</span><span class="pl-kos">,</span>
                <span class="pl-c1">path</span>: <span class="pl-s">'runs/:runId'</span><span class="pl-kos">,</span>
                <span class="pl-c1">resolve</span>: <span class="pl-kos">{</span>
                    <span class="pl-c1">deleteRun</span>: <span class="pl-smi">DeleteRunResolve</span><span class="pl-kos">,</span>
                    <span class="pl-c1">run</span>: <span class="pl-smi">RunResolve</span>
                <span class="pl-kos">}</span>
            <span class="pl-kos">}</span><span class="pl-kos">,</span>
            <span class="pl-kos">{</span>
                <span class="pl-c1">canActivate</span>: <span class="pl-kos">[</span><span class="pl-smi">RedirectToLastRunGuard</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
                <span class="pl-c1">component</span>: <span class="pl-smi">RunsComponent</span><span class="pl-kos">,</span>
                <span class="pl-c1">path</span>: <span class="pl-s">'runs'</span>
            <span class="pl-kos">}</span>
        <span class="pl-kos">]</span><span class="pl-kos">,</span>
        <span class="pl-c1">component</span>: <span class="pl-smi">SimulationComponent</span><span class="pl-kos">,</span>
        <span class="pl-c1">path</span>: <span class="pl-s">''</span><span class="pl-kos">,</span>
        <span class="pl-c1">resolve</span>: <span class="pl-kos">{</span>
            <span class="pl-c1">createRun</span>: <span class="pl-smi">CreateRunResolve</span><span class="pl-kos">,</span>
            <span class="pl-c1">createSimulation</span>: <span class="pl-smi">CreateSimulationResolve</span><span class="pl-kos">,</span>
            <span class="pl-c1">deleteSimulation</span>: <span class="pl-smi">DeleteSimulationResolve</span><span class="pl-kos">,</span>
            <span class="pl-c1">runs</span>: <span class="pl-smi">RunsResolve</span><span class="pl-kos">,</span>
            <span class="pl-c1">simulation</span>: <span class="pl-smi">SimulationResolve</span>
        <span class="pl-kos">}</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">]</span></pre></div>
<p dir="auto"><strong>What is the motivation / use case for changing the behavior?</strong></p>

<p dir="auto">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 ;))</p>
<p dir="auto">This is a copy of <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="290537224" data-permission-text="Title is private" data-url="https://github.com/angular/angular/issues/21702" data-hovercard-type="issue" data-hovercard-url="/angular/angular/issues/21702/hovercard" href="https://github.com/angular/angular/issues/21702">#21702</a> which has been locked due to inactivity. Still it is relevant.</p>
<h3 dir="auto">I'm submitting a...</h3>
<p dir="auto">[ ] Regression<br>
[ ] Bug report<br>
[X] Feature request<br>
[ ] Documentation issue or request<br>
[ ] Support request</p>
<h3 dir="auto">Current behavior</h3>
<p dir="auto">When having multiple async guards (returning promise or observable) for the same path they execute at the same time:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  path: '',
  canActivate: [
        AuthGuard,
        DetectLanguage,
        GetAppData,
  ],
  children: [ ... ]
}"><pre class="notranslate"><span class="pl-kos">{</span>
  <span class="pl-c1">path</span>: <span class="pl-s">''</span><span class="pl-kos">,</span>
  <span class="pl-c1">canActivate</span>: <span class="pl-kos">[</span>
        <span class="pl-smi">AuthGuard</span><span class="pl-kos">,</span>
        <span class="pl-smi">DetectLanguage</span><span class="pl-kos">,</span>
        <span class="pl-smi">GetAppData</span><span class="pl-kos">,</span>
  <span class="pl-kos">]</span><span class="pl-kos">,</span>
  <span class="pl-c1">children</span>: <span class="pl-kos">[</span> ... <span class="pl-kos">]</span>
<span class="pl-kos">}</span></pre></div>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">There should be an option to let them execute synchronous:</p>
<ul dir="auto">
<li>guard[i+1] should wait for guard[i] to finish</li>
<li>If guard[i] returns false all following guards should not execute</li>
</ul>
<h3 dir="auto">What is the motivation / use case for changing the behavior?</h3>
<p dir="auto">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.</p>
<h3 dir="auto">Workaround</h3>
<p dir="auto">Kinda ugly and confusing workaround:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
      path: '',
      canActivate: [
         AuthGuard,
      ],
      children: [
        {
          path: '',
          canActivate: [
             DetectLanguage,
          ],
          children: [
             {
                path: '',
                canActivate: [
                    GetAppdata,
                ],
                component: MyComponent,
             }
         }
      ]
    }"><pre class="notranslate"><span class="pl-kos">{</span>
      <span class="pl-c1">path</span>: <span class="pl-s">''</span><span class="pl-kos">,</span>
      <span class="pl-c1">canActivate</span>: <span class="pl-kos">[</span>
         <span class="pl-smi">AuthGuard</span><span class="pl-kos">,</span>
      <span class="pl-kos">]</span><span class="pl-kos">,</span>
      <span class="pl-c1">children</span>: <span class="pl-kos">[</span>
        <span class="pl-kos">{</span>
          <span class="pl-c1">path</span>: <span class="pl-s">''</span><span class="pl-kos">,</span>
          <span class="pl-c1">canActivate</span>: <span class="pl-kos">[</span>
             <span class="pl-smi">DetectLanguage</span><span class="pl-kos">,</span>
          <span class="pl-kos">]</span><span class="pl-kos">,</span>
          <span class="pl-c1">children</span>: <span class="pl-kos">[</span>
             <span class="pl-kos">{</span>
                <span class="pl-c1">path</span>: <span class="pl-s">''</span><span class="pl-kos">,</span>
                <span class="pl-c1">canActivate</span>: <span class="pl-kos">[</span>
                    <span class="pl-smi">GetAppdata</span><span class="pl-kos">,</span>
                <span class="pl-kos">]</span><span class="pl-kos">,</span>
                <span class="pl-c1">component</span>: <span class="pl-smi">MyComponent</span><span class="pl-kos">,</span>
             <span class="pl-kos">}</span><span class="pl-kos"></span>
         <span class="pl-kos">}</span>
      <span class="pl-kos">]</span>
    <span class="pl-kos">}</span></pre></div>