Angular - Navigate to current same URL with component reload not the whole page

Discussão em 'Angular' iniciado por Ebraheem Alrabeea, Dezembro 3, 2024.

  1. I am using Angular 5 library, I want to navigate to the current URL with reload (refresh) the whole component, not the page, I have read about navigation to current URL in Angular document.

    And that it is what I need:

    /**
    * Define what the router should do if it receives a navigation request to the current URL.
    * By default, the router will ignore this navigation. However, this prevents features such
    * as a "refresh" button. Use this option to configure the behavior when navigating to the
    * current URL. Default is 'ignore'.
    */
    onSameUrlNavigation: 'reload' | 'ignore';


    Now, I have tried to set the onSameUrlNavigation property to reload and then navigate to the same URL, but nothing happend, like this:

    this.router.onSameUrlNavigation = 'reload';
    this.router.navigate(['view'], { queryParams: { QueryUUID: selectedId } });


    Anyone who has used this before can help?

    Continue reading...

Compartilhe esta Página