我的Angular 5路由包含错误;我无法弄清楚是什么 . 见下文:
-
默认情况下,未经身份验证的用户会显示登录框
在localstorage中具有令牌的 -
用户被自动重定向到/ secure
-
/ secure使用pathMatch "full"重定向到其/ dashboard子级 .
到目前为止一切正常 . 现在,我直接将浏览器的URL设置为/ secure / admin / users . 我希望看到用户管理页面 . 然而,我根据“redirectTo”语句(在这种情况下是仪表板)重定向 .
我的路线有什么明显的错误吗?提前致谢 .
const appRoutes: Routes = [
{ path: '', component: LoginComponent,
data: { },
canActivate: [AuthAutoRedirectService]
},
{ path: 'secure', component: WrapperComponent,
data: { },
canActivate: [AuthGuardService],
children: [
{ path: '', pathMatch: 'full', redirectTo: 'dashboard'},
{ path: 'dashboard', component: DashboardComponent, data: {}, canActivate: [] },
{ path: 'admin', data: { roles: [] }, canActivate: [AuthGuardService], children: [
{ path: 'users', data: {}, canActivate: [], children: [
{ path: '', pathMatch: 'full', component: AdminUserComponent },
{ path: 'add-user', component: AddUserComponent }
]},
]}
]
}
];