Angular 角度2-路由-在浏览器地址栏中显示不同的路由名称

Angular 角度2-路由-在浏览器地址栏中显示不同的路由名称,angular,angular2-routing,Angular,Angular2 Routing,是否可以在地址栏中显示角度2和角度4中特定路线的状态名称。例如,我有以下路线配置 { path:"animals", component : AnimalComponent, children:[{ path:"cat", component:CatComponent },{ path:"dog", component:DogComponent }] } 当地址为“动物/猫”时,它在AnimalComponent路由器出口中加载CatComponent,当地址为“

是否可以在地址栏中显示角度2和角度4中特定路线的状态名称。例如,我有以下路线配置

{
 path:"animals",
 component : AnimalComponent,
 children:[{
   path:"cat",
   component:CatComponent
 },{
  path:"dog",
  component:DogComponent
 }]
}

当地址为“动物/猫”时,它在AnimalComponent路由器出口中加载CatComponent,当地址为“动物/狗”时,它在AnimalComponent路由器出口中加载DogComponent。是否可以在地址栏中仅显示“动物/猫”的“猫”和“动物/狗”路线的地址栏中的“狗”。

当然,只需从父路线中删除路径:

{
 path:"",
 component : AnimalComponent,
 children:[{
   path:"cat",
   component:CatComponent
 },{
  path:"dog",
  component:DogComponent
 }]
}

angular将自动将子项链接到最近的祖先(或根,如果没有的话)

听起来像是在寻找类似的东西,或者只是用一些其他数据设置了
标题。请参阅:谢谢。我在哪里可以找到关于这方面的文档。在他们的官方文件中有一个很长的部分解释了Angular router是如何工作的:对于您的具体案例,您可以查看名为“无组件路由”的部分,其中有一个与您的示例非常类似的示例。