我正在使用 Angular 8,希望在相同的 URL 上刷新组件而不需要刷新整个页面。我尝试使用 router.navigate,但对我无效。我尝试过 location.reload 和 window.location.reload,但时间太长且会刷新整个页面。以下是我的代码:
this.snackBar.open('Data Updated Successfully', 'Undo', {
duration: 5000,
});
this.router.navigate(['/get_customer_details/'+this.customer_details_id]);
console.log(this.customer_details_id);
this.ngOnInit();