Answers for "reload the page in angular"

2

angular refresh page without reloading

this.router.navigate(['path/to'])
  .then(() => {
    window.location.reload();
  });
Posted by: Guest on January-06-2021
4

How to Reload a Component in Angular

reloadComponent() {
  let currentUrl = this.router.url;
      this.router.routeReuseStrategy.shouldReuseRoute = () => false;
      this.router.onSameUrlNavigation = 'reload';
      this.router.navigate([currentUrl]);
  }
Posted by: Guest on September-25-2020
0

refresh page angular

refresh(): void {
    window.location.reload();
}
Posted by: Guest on March-16-2021
0

how to make a component reload in angular

DeleteEmployee(id:number)
  {
    this.employeeService.deleteEmployee(id)
    .subscribe( 
      (data) =>{
        console.log(data);
        this.ngOnInit();
      }),
      err => {
        console.log("Error");
      }   
  }
Posted by: Guest on October-16-2020
2

angular typescript refresh page

this.router.routeReuseStrategy.shouldReuseRoute = function(){
            return false;
         };
this.router.events.subscribe((evt) => {
            if (evt instanceof NavigationEnd) {
               // trick the Router into believing it's last link wasn't previously loaded
               this.router.navigated = false;
               // if you need to scroll back to top, here is the right place
               window.scrollTo(0, 0);
            }
        });
Posted by: Guest on March-03-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language