这就是我的模块的外观
const routes: Routes = [
{
path: 'home', component: HomeComponent,
children: [
{ path: '', redirectTo: 'compact', pathMatch: 'full' },
{ path: 'compact', component: CompactComponent },
{ path: 'reports', component: ResearchReportsComponent },
]
}
];
@NgModule({
imports: [
CommonModule
RouterModule.forChild(routes)
],
declarations: [
HomeComponent
]
})
export class HomeModule {
}
我想让redirectTo
值取决于来自myservice的变量。