angular navigate to the same route with different parameter

Discussão em 'Angular' iniciado por jazza1000, Abril 5, 2025.

  1. jazza1000

    jazza1000 Guest

    Although this question seems to have popped up before, I can't find an answer that works for me, as the router seems to have changed a lot over the lifetime of angular.

    In angular 5 I have a component where I wish to edit a user. I navigate to that component with the following code:

    this.router.navigate(['editsingleuser',user.username])


    Which will send me to /editsingleuser/bob

    Then, from within that component I can also click on a button to edit my own user details, which uses the following code:

    this.router.navigate(['editsingleuser',this.user.sub])


    Which should send me to /editsingleuser/joe, but does not

    Is there a parameter that I can add to the router.navigate that forces it to load the route, as it seems to be doing some kind of caching?

    I have also tried using

    [routerLink]="['editsingleuser',user?.sub]"


    which also has the same issue

    Continue reading...

Compartilhe esta Página