这是app.routing.ts-主路由文件
const APP_ROUTES: Routes = [
{ path: '', component: SecureComponent, canActivate: [AuthService], children : SECURE_ROUTES}
, { path: '', component: PublicComponent, children : PUBLIC_ROUTES}
];
这是secure_routes和public_routes:
export const SECURE_ROUTES: Routes = [
{
path: 'Order', component: OrderOutletComponent,
children: [
{ path: 'new', component: AddOrder},
{ path: '', component: OrdersComponent},
{
path: ':id',
children: [
{ path: '', component: OrderComponent},
{ path: 'edit', component: EditComponent}
]
}
]
},
{ path: 'Dashboard', component: DashboardComponent }];
我已将app.routing加载到我的应用程序模块-顶级模块中。 例如,当我尝试打开网址http://host/Order时-订单组件未加载,并且显示空白页面,并且网址栏中的网址也更改为http://host/
但是http://host/dashboard会正确加载仪表板组件。