Trying to understand the differences between CanActivate and CanActivateChild : <p>So, I'm trying to protect the access to several routes by using guards. I'm using the following routes to do so :</p>

<pre><code>const adminRoutes : Routes = [
  {
    path: 'admin',
    component: AdminComponent,
    canActivate: [ AuthGuardService ],
    children : [
      {
        path: '',
        canActivateChild: [ AuthGuardService ],
        children: [
          { path: 'edit', component: DashboardComponent},
          { path: '', component: DashboardComponent}
        ]
      }
    ]
  }
];
</code></pre>

<p>Here's a look at what <code>AuthGuardService</code> looks like</p>

<pre><code>import { Injectable } from '@angular/core';
import {CanActivate, Router, ActivatedRouteSnapshot, RouterStateSnapshot} from "@angular/router";

@Injectable()
export class AuthGuardService implements CanActivate{

  constructor(private router: Router) { }

  canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot){
    console.log("Guarding...");
    return this.sessionValid();
  }

  canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot){
    console.log("Guarding children...");
    return this.canActivate(route, state);
  }

  sessionValid() : boolean {
    //tests
  }

}
</code></pre>

<p>When I try to access to '/admin' and '/admin/edit' with <code>canActivate</code> only (<code>canActivateChild</code> is commented) the console displays</p>

<pre><code>Guarding...
</code></pre>

<p>When I remove <code>canActivate</code>and bring <code>canActivateChild</code>back the console displays </p>

<pre><code>Guarding children...
</code></pre>

<p>When I keep both, it goes back to displaying <code>Guarding...</code>.
So, my question is what's the purpose of having <code>canActivateChild</code> when <code>canActivate</code>protects both the root element and the children ?</p>

<p>PS : I get it that <code>canActivateChild</code> runs before the child route is activated. But what are the benefits of that ? Isn't keeping only one of them sufficient ?</p>
