Angular 5 EmptyError:在创建子路由时没有顺序元素

A_J*_*A_J 6 routing angular

当我在路由中使用子项时,我无法从登录页面导航到仪表板页面,如下所示:

const appRoutes: Routes = [
{ path: '', redirectTo: 'login', pathMatch: 'full' },
{ path: 'login', component: LoginComponent,pathMatch: 'full' },
{
  path: 'dashboard',pathMatch: 'full', /* canActivate: [AuthGuard], */ component: DashboardComponent , 
  children: [
    {
      path: 'online-submission/:moduleName',pathMatch: 'full', component: OnlineSubmissionComponent, 
      /* canActivate: [AuthGuard], */data:{
          breadcrumb: "online-submission"
      } ,
      children: [
        { path: 'batch-upload-members',pathMatch: 'full', component: BatchUploadMembersComponent, 
        /* canActivate: [AuthGuard], */data:{
            breadcrumb: "batch-upload-members"
        } },
        { path: 'select-members',pathMatch: 'full', component: SelectMembersComponent, 
        /* canActivate: [AuthGuard], */data:{
            breadcrumb: "select-members"
        } 
       }
      ] 
    }
  ] 
},
{ path: '**', component: PageNotFoundComponent }
Run Code Online (Sandbox Code Playgroud)

].

但是,当我从路由中删除子属性并使其兄弟姐妹路由工作正常.制作儿童路线时有什么问题?我正在使用cli 1.6.0-rc.1

到目前为止我尝试了什么?

  1. 评论AuthGuard没有用,所以问题不在于那个部分

  2. 我已经证实,只有当我将它们作为儿童路线(我需要制作面包屑)时才会出现这个问题.如果所有路由都是兄弟,则路由正常

  3. {enableTracing:true}RouterModule.forRoot哪里,我觉得NavigationStart(id: 4, url: '/dashboard')这似乎对DashboardComponent正确的URL

  4. 在SO上搜索类似的标题问题,但没有一个解决同一问题:

Angular 2.0.1路由器EmptyError:顺序没有元素

Angular2路由问题 - 区域感知错误序列中没有元素

Angular 2.0.1路由器EmptyError:顺序没有元素

Nas*_*din 13

此错误是由Angular的路由器的最新版本引起的.请删除还原角度版本或添加pathMatch:'full'到您的路线.

export const userRoutes = [
    { path: 'profile', component: ProfileComponent, pathMatch: 'full' },
    { path: 'login', component: LoginComponent, pathMatch: 'full' }
];


export const appRoutes = [
    { path: '', redirectTo: '/events', pathMatch: 'full' },
    { path: 'user', loadChildren: './user/user.module#UserModule' }
];
Run Code Online (Sandbox Code Playgroud)

你可以在这里找到问题