【发布时间】:2020-05-11 22:55:52
【问题描述】:
当我尝试转到 myaddress/home 时,我收到了错误消息。当用户输入地址行 myaddress/home 时,需要将他重定向到 myaddress/home/allQuestions。另一条路线有效。我使用角度 8。
常量路线:路线= [ { 路径:'',组件:MainLayoutComponent,孩子:[ {path: '', redirectTo: '/login', pathMatch: 'full'}, {路径:'登录',组件:LoginFormComponent}, {路径:'注册',组件:RegistrationFormComponent} ] }, { 路径:'home',组件:HomeLayoutComponent,孩子:[ {path: '', redirectTo: '/allQuestions', pathMatch: 'full'}, {路径:'allQuestions',组件:AllQuestionsComponent}, {路径:'addQuestion',组件:AddQuestionComponent}, ], canActivate: [AuthenticationGuard] } ];错误:
ERROR 错误:未捕获(在承诺中):错误:无法匹配任何路由。 URL 段:'allQuestions' 错误:无法匹配任何路由。 URL 段:'allQuestions'
【问题讨论】: