Angularjs   发布时间:2022-04-20  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Angular 5 EmptyError:在创建子路由时没有顺序元素大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
当我在路由中使用子项时,我无法从登录页面导航到仪表板页面,如下所示:

@H_489_7@const appRoutes: Routes = [ { path: '',redirectTo: 'login',pathMatch: 'full' },{ path: 'login',component: LoginComponent,{ path: 'dashboard',pathMatch: 'full',/* canActivate: [AuthGuard],*/ component: DashboardComponent,children: [ { path: 'online-submission/:modulename',component: OnlinesubmissionComponent,*/data:{ breadcrumb: "online-submission" },children: [ { path: 'batch-upload-members',component: BatchUploadMembersComponent,*/data:{ breadcrumb: "batch-upload-members" } },{ path: 'SELEct-members',component: SELEctMembersComponent,*/data:{ breadcrumb: "SELEct-members" } } ] } ] },{ path: '**',component: PageNotFoundComponent }

].

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

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

>评论AuthGuard没有用,所以问题不在于那部分
>我已经证实,只有当我将它们作为儿童路线(我需要制作面包屑)时才会出现这个问题.如果所有路由都是兄弟,则路由正常
>在RouterModule.forRoot中使用{enableTracing:truE},我在其中找到NavigationStart(id:4,url:’/ dashboard’),这对于DashboardComponent来说似乎是正确的url
>在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:’full’到您的路线.

@H_489_7@export const userRoutes = [ { path: 'profile',component: ProfileComponent,pathMatch: 'full' } ]; export const appRoutes = [ { path: '',redirectTo: '/events',{ path: 'user',loadChildren: './user/user.module#UserModule' } ];

你可以找到问题here

大佬总结

以上是大佬教程为你收集整理的Angular 5 EmptyError:在创建子路由时没有顺序元素全部内容,希望文章能够帮你解决Angular 5 EmptyError:在创建子路由时没有顺序元素所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。