how to make a component reload in angular
reloadComponent() {
let currentUrl = this.router.url;
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
this.router.onSameUrlNavigation = 'reload';
this.router.navigate([currentUrl]);
}reloadCurrentRoute() {
let currentUrl = this.router.url;
this.router.navigateByUrl('/', {skipLocationChange: true}).then(() => {
this.router.navigate([currentUrl]);
});
}
DeleteEmployee(id:number)
{
this.employeeService.deleteEmployee(id)
.subscribe(
(data) =>{
console.log(data);
this.ngOnInit();
}),
err => {
console.log("Error");
}
}
Also in JavaScript:
- js string
- sort javascript array
- swift append to array
- jQuery element with multiple classes
- javascript object entries
- array to comma separated list js
- tableau javascript
- slickcdn
- javascript random six digit number with animation
- javascript if and statement
- for in loops javascript
- new date() in javascript 3 days from now
- react slick
- get month angular with 0
- sum array without loop javascript
- install nuxt js
- variable defaults javascript es6
- objectid is not defined node js mongodb
- js navigate to another page
- laravel fetch post
- javascript Bingo add called number to a list
- javascript get object from array where property equals
- how to connect react to backend
- javascript return string in alphabetical order