这是我的路由代码:
const dashboard_routes: Routes = [
{
path: 'dashboard',
component: ApplicationComponent,
children: [
{
path: 'product', component: ProductHomeComponent,
children:[
{
path:'',component: ProductIndex
},
{
path: 'new', component: NewProductComponent
},
]
},
{
path: '', component: DashboardIndexComponent
}
]
}
]
当我输入" / dashboard / product"或" / dashboard / product / new"在浏览器中 它的工作 但是当我输入" / dashboard / product / xxx"或" / product / *"
之后的任何其他字符 发生问题: exception image但如果我输入' / dashboard / *' ,app返回404,其真实;
这是404路线代码:
const dashboardRoutes: Routes = [
{
path: 'dashboard',
loadChildren: 'src/module/dashboard.module#DashboardModule',
}
];
const appRoutes: Routes = [
...dashboardRoutes,
{
path: '',
redirectTo: '/login',
pathMatch: 'full'
},
{path: '**', component: PageNotFoundComponent}
]
export const appRoutingProviders: any[] = [];
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);
如何解决这个问题?