angular - router.navigate changes the URL, but is not rendering the component -
instead of using <a href="/my-path/{{my_param}}"></a> in template, willing use function paramters redirect me page.
so, how built function in .ts file:
redirecttochat(my_param){ this.router.navigate(['./my-path/' + my_param ]); } and how called in template:
<div (click)="redirecttochat(my_param)"> ... </div> it changes url, not rendering component. imported in component:
import { router, activatedroute, parammap } '@angular/router'; and used in constructor: private router: router
can me render corrctly component? how else can redirect user page using function?
you mixing navigate (to component) navigate url. have tried navigatebyurl?
this.router.navigatebyurl('./my-path/' + my_param);
Comments
Post a Comment