Angular 2 routing to the same route

后端 未结 1 567
太阳男子
太阳男子 2021-01-19 18:44

I have Ride component, and in the end of the ride the Ride Summary is shown.

The right summary has a button to \"Start another ride\" which

1条回答
  •  野的像风
    2021-01-19 19:35

    Router doesn't navigate if the route and params haven't changed, by default.


    To make it navigate you can define

    routerCanReuse(nextInstruction: ComponentInstruction, 
                   prevInstruction: ComponentInstruction){
      return false;
    }
    

    in your component, that you want to renvaigate to, and call

    Router.renavigate();

    this.router.navigate('RouteName', this.routeParams.params)
    

    to renavigate.

    0 讨论(0)
提交回复
热议问题