Angular canActivateChild被多次调用

Angular canActivateChild被多次调用,angular,angular-routing,Angular,Angular Routing,在angular 5项目中,我根据登录的用户角色“保护”了一些视图, 因此,在我的路由模块中,我有: path: '', component: AdminLayoutComponent, canActivate: [AuthGuard], canActivateChild: [RoleGuard], children: [ { path: '', loadChildren: './dashboard/dashbo

在angular 5项目中,我根据登录的用户角色“保护”了一些视图, 因此,在我的路由模块中,我有:

    path: '',
    component: AdminLayoutComponent,
    canActivate: [AuthGuard],
    canActivateChild: [RoleGuard],
    children: [
      {
        path: '',
        loadChildren: './dashboard/dashboard.module#DashboardModule',
        data: { roles: ['role.all'] }
      },
      {
        path: 'checkPoints',
        loadChildren: './check-points/check-point-list/check-point-list.module#CheckpointListModule',
        data: { roles: ['role.admin', 'role.tech', 'role.backoffice'] }
      }...
AuthGuard检查用户是否经过身份验证,然后RoleGuard检查登录的用户是否具有查看页面的角色。 但是当我尝试导航到子路由时,我看到多次调用canActivateChild方法(2-3次)

这是正确的行为吗

{
        path: "",
        component: AdminLayoutComponent,
        canActivate: [AuthGuard],
        children: [
            {
                path: "",
                canActivate: [RoleGuard],
                children: [
                    {
                      path: '',
                      loadChildren: './dashboard/dashboard.module#DashboardModule',
                      data: { roles: ['role.all'] }
      },...

我认为这样可以防止2-3次。

我有这个错误
core.js:1448错误错误:Uncaught(承诺中):TypeError:guard不是函数TypeError:guard不是MapSubscriber.eval[as project](router.js:3863)的函数。_next(map.js:79)在MapSubscriber.Subscriber.next(Subscriber.js:92)