[尝试解决路由子问题,但无法解决。如果我单击管理按钮不起作用,则无法重定向到管理部分。如何解决此问题。
演示:https://stackblitz.com/edit/angular-3mngoh?file=src/app/approuting.module.ts
approuting.module.ts:
const routes: Routes = [
{
path: 'admin',
component: AdminSectionComponent,
children: [
{ path: '', loadChildren: () => import('./adminsection/layout/layout.module').then(m => m.LayoutModule) },
{ path: 'login', loadChildren: () => import('./adminsection/login/login.module').then(m => m.LoginModule) },
{ path: 'signup', loadChildren: () => import('./adminsection/signup/signup.module').then(m => m.SignupModule) },
{ path: 'error', loadChildren: () => import('./adminsection/server-error/server-error.module').then(m => m.ServerErrorModule) },
{ path: 'access-denied', loadChildren: () => import('./adminsection/access-denied/access-denied.module').then(m => m.AccessDeniedModule) },
{ path: 'not-found', loadChildren: () => import('./adminsection/not-found/not-found.module').then(m => m.NotFoundModule) },
{ path: '**', redirectTo: 'not-found' }
]
},....etc
尝试解决路由子问题,但无法解决。如果我单击管理按钮不起作用,则无法重定向到管理部分。如何解决此问题。演示:https://stackblitz.com / ...
路由未发生,因为从用户界面单击admin的矛盾是寻找/ login,这表明未找到并给出错误。因此,在分析之后,我发现AdminSection-RoutingModule.ts中的注释行。这是您的代码路由数组用下面的代码替换。