【发布时间】:2019-12-03 09:16:04
【问题描述】:
在 Angular8 中,我有一个页面列出了一些信息,并且在从当前页面删除行后有删除选项,我需要刷新当前页面以便更新内容。我为此使用了导航,但由于同一页面导航问题而无法正常工作
下面是我删除记录的代码
deleteBusiness(id) {
this.bs.deleteBusiness(id).subscribe(
res =>{console.log(res)},
error=>console.log(error.message),
()=>{this.router.navigate(['business'])}
);
}
我在定义的死记中使用了onSameUrlNavigation,但它不起作用。
请让我知道这里遗漏了什么
以下是我的路线配置
const routes: Routes = [
{
path: 'business/create',
component: GstAddComponent
},
{
path: 'business/edit/:id',
component: GstEditComponent
},
{
path: 'business',
component: GstGetComponent,
runGuardsAndResolvers: 'always'
},
{
path: '',
redirectTo: "/business",
pathMatch :"full"
},
];
我已使用以下链接退出此问题
Angular 6 router link issue in the same page
但没有成功。请提出一种解决方法
【问题讨论】: