![](/img/trans.png)
[英]Why I can't use the Router object inside a function definied for the then() of a CRUD delete operation into my Angular service?
[英]I use angular router and can't use path:'**' for 404 page
export const AppRoutes: Routes = [
{path: '', redirectTo: 'dashboard', pathMatch: 'full'},
{path: 'login', component: LoginComponent},
{path: 'register', component: RegisterComponent},
{
path: '',
component: FullComponent,
canLoad: [LoginGuard],
children: [
{
path: '',
loadChildren: () => import('./material-component/material.module').then(m => m.MaterialComponentsModule)
},
{path: 'dashboard', loadChildren: () => import('./dashboard/dashboard.module').then(m => m.DashboardModule)}
]
},
{path: '**', component: PageNotFoundComponent}
];
但是404页面只能匹配:'/a''/b'不能匹配:'/a/b''/c/d'
我认为'' url 对儿童不正确:
你能试试吗
{ path: '**', pathMatch: 'full', component: PageNotFoundComponent },
你是对的问题是。你的代码应该是这样的。
{
path: 'material',
loadChildren: () => import('./material-component/material.module').then(m => m.MaterialComponentsModule)
},
并在 MaterialComponentRountingModule
{
path: '',
component:MaterialComponent
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.