返回到上一页,然后以角度输入嵌套的URL

时间:2018-12-21 12:45:48

标签: angular

我的路线如下:

    const routes: Routes = [
  {path: '', redirectTo: 'home', pathMatch: 'full'},
  {path: 'find', redirectTo: 'search'},
  {path: 'home', component: HomeComponent},
  {path: 'search', component: SearchComponent},
  {
    path: 'artist/:artistId',
    component: ArtistComponent,
    children: [
      {path: '', redirectTo: 'tracks'}, 
      {path: 'tracks', component: ArtistTrackListComponent}, 
      {path: 'albums', component: ArtistAlbumListComponent}, 
    ]
  },
  {path: '**', component: HomeComponent}
];

可以从任何页面导航到子页面并在它们之间切换。有一个按钮可以将我们带回到子页面的导航页面。

例如: 如果某人从主页导航至“ artist /:artistId /曲目”,然后导航至“ artist /:artistId /相册”。如果该人单击“后退”按钮,则用户应导航至主页。

0 个答案:

没有答案