1reloadComponent() {
2 let currentUrl = this.router.url;
3 this.router.routeReuseStrategy.shouldReuseRoute = () => false;
4 this.router.onSameUrlNavigation = 'reload';
5 this.router.navigate([currentUrl]);
6 }
1reloadCurrentRoute() {
2 let currentUrl = this.router.url;
3 this.router.navigateByUrl('/', {skipLocationChange: true}).then(() => {
4 this.router.navigate([currentUrl]);
5 });
6}
7
1this.router.navigateByUrl('/RefreshComponent', { skipLocationChange: true }).then(() => {
2 this.router.navigate(['Your actualComponent']);
3});
1DeleteEmployee(id:number)
2 {
3 this.employeeService.deleteEmployee(id)
4 .subscribe(
5 (data) =>{
6 console.log(data);
7 this.ngOnInit();
8 }),
9 err => {
10 console.log("Error");
11 }
12 }
13