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

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -