Angular 有条件<;路由器出口>;

Angular 有条件<;路由器出口>;,angular,typescript,angular-ui-router,angular-router,Angular,Typescript,Angular Ui Router,Angular Router,我在父页面上有一个路由器插座,上面显示“Hello World!” 是否可以使用条件语句在父页面而不是所有子页面中显示“Hello world!”?从路由器出口中删除该Hello world,只需添加一个新的子路由(路径为空)和一个显示Hello world的组件: { path: 'parentPage', component: MasterComponent, canActivate:[AuthGuard], children: [ { path: '', co

我在父页面上有一个路由器插座,上面显示“Hello World!”


是否可以使用条件语句在父页面而不是所有子页面中显示“Hello world!”?

从路由器出口中删除该Hello world,只需添加一个新的子路由(路径为空)和一个显示Hello world的组件:

{ 
  path: 'parentPage', 
  component: MasterComponent, 
  canActivate:[AuthGuard],
  children: [
    { path: '', component: SomeComponentDisplayingHelloWorld },
    { path: 'ChildPage1', component:ChildPage1Component },
    { path: 'ChildPage2', component:ChildPage2Component },
  ]
}

从路由器出口内移除Hello World,只需添加一个新的子路由,其中包含一个空路径,以及一个显示Hello World的组件:

{ 
  path: 'parentPage', 
  component: MasterComponent, 
  canActivate:[AuthGuard],
  children: [
    { path: '', component: SomeComponentDisplayingHelloWorld },
    { path: 'ChildPage1', component:ChildPage1Component },
    { path: 'ChildPage2', component:ChildPage2Component },
  ]
}

添加一个额外的子路由,路径为空字符串,并将该HelloWorld字符串放入该子路由组件模板中。您能否给出在路由防御中谈论的行的示例。ts?
children:[{path:'',component:SomeComponentDisplayingHelloWorld},…]
请将其标记为答案,它起作用了。。谢谢!添加一个额外的子路由,路径为空字符串,并将该HelloWorld字符串放入该子路由组件模板中。您能否给出在路由防御中谈论的行的示例。ts?
children:[{path:'',component:SomeComponentDisplayingHelloWorld},…]
请将其标记为答案,它起作用了。。谢谢!
{ 
  path: 'parentPage', 
  component: MasterComponent, 
  canActivate:[AuthGuard],
  children: [
    { path: '', component: SomeComponentDisplayingHelloWorld },
    { path: 'ChildPage1', component:ChildPage1Component },
    { path: 'ChildPage2', component:ChildPage2Component },
  ]
}