当使用带有[routerLink]
的锚标记或通过code
使用以下内容重定向到路线时返回上一页:
router.navigate(['/path'])
示例:如果我从结果页面重定向到extractedData
页面,它只会显示extractedData
页面,然后立即重定向到结果页面。这是我的路由模块。
export const routes:Routes=[
{ path: '', redirectTo: '/home', pathMatch: 'full' },
{path:'home', component:HomeComponent, data:{title:'Home'}},
{path:'list',component:ListComponent, data:{title:'List'}},
{path:'resultDetails',component:ResultDetailsComponent,data:{title:'Result Details'}},
{path:'result',component:ResultComponent,data:{title:'Result'}},
{path:'extractedData',component:ExtractedDataComponent,data:{title:'Extracted Data'}}
]
答案 0 :(得分:1)
尝试以下代码
router.navigate['/extractedData']