How to reload a component without reloading the whole page

Discussão em 'Angular' iniciado por Tanzeel, Dezembro 12, 2024.

  1. Tanzeel

    Tanzeel Guest

    I want to reload a route but without reloading the entire page. This is not what I want:

    window.location.reload();


    I want to reload just the component not the page. This is waht I tried:

    1. Angular: Change the route without reloading
    2. Angular: Refetch data on same URL navigation

    Some other random tricks also I tried. Tried following code from this URL:


    1. Angular Basics: Refresh an Angular Component without reloading the same Component

      mySubscription: any;

      constructor() {
      this.router.routeReuseStrategy.shouldReuseRoute=function() {
      return false;
      }

      this.mySubscription= this.router.events.subscribe((event)=> {
      if(event instanceof NavigationEnd) {
      // Trick the Router into believing it's last link wasn't previously loaded
      this.router.navigated=false;
      }
      })
      }

    But It's not working due to other reasons. I need a solution. Please suggest something else.

    Continue reading...

Compartilhe esta Página