角5 EmptyError:在序列中没有的元素,同时使子路由
我无法从登录页面导航到仪表板页面,当我使用儿童路由如下:角5 EmptyError:在序列中没有的元素,同时使子路由
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 } 
]。
但是,当我从路线中删除子属性,并使他们兄弟姐妹路由工作正常。我制作小孩路线时会出现什么问题?我正在使用cli 1.6.0-rc.1
我到目前为止试过了什么?
评论AuthGuard没有工作,所以这个问题是不是与部分
我核实,只有当我让他们为孩子的路线(我需要制作面包屑)出现此问题。如果所有的路线都是兄弟姐妹,路由正常工作
使用
{enableTracing:true}在RouterModule.forRoot在那里我找到NavigationStart(id: 4, url: '/dashboard')这似乎是正确的URL DashboardComponent搜查SO类似标题的问题,但没有一个解决同一个问题:
Angular 2.0.1 Router EmptyError: no elements in sequence
Angular2 routing issues - Zone aware error No elements in sequence
Angular 2.0.1 Router EmptyError: no elements in sequence
回答:
此错误是由于Angular路由器的最新版本。 请删除恢复角度版本或添加pathMatch:'充分'到您的路线。
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' } 
]; 
您可以找到问题here
以上是 角5 EmptyError:在序列中没有的元素,同时使子路由 的全部内容, 来源链接: utcz.com/qa/259286.html

