应用程序运行正常,但上传子路由也可以在没有“/upload”的情况下访问。例如“/照片”、“/广告”。这不应该发生。我不知道为什么会这样。如果有人知道解决方案,请回复。
app.routing.ts
{ path: '', redirectTo: '/dashboard', pathMatch: 'full'},
{path: '', loadChildren: 'app/campsite/campsite.module#CampsiteModule'},
{path: 'login', loadChildren: 'app/login/login.module#LoginModule'}
露营地.routing.ts
path: '', component: CampsiteComponent, children: [
{path: 'dashboard', component: HomeComponent, canActivate: [AuthGuard]},
{path: 'gallery', component: GalleryComponent, canActivate: [AuthGuard]},
{path: 'upload', loadChildren: './upload/upload.module#UploadModule', canActivate: [AuthGuard]}
]
上传.路由.ts
path: '', component: UploadComponent, children: [
{path: 'photo', component: PhotoComponent, canActivate: [AuthGuard]},
{path: 'advertisement', component: AdvertisementComponent, canActivate: [AuthGuard]},
{path: 'video', component: VideoComponent, canActivate: [AuthGuard]},
{path: 'logo', component: LogoComponent, canActivate: [AuthGuard]},
{ path: 'photo', pathMatch: 'full', redirectTo: 'photo' }
]