Answers for "how to pass parameter to router.navigate in angular"

2

router navigate pass params

this.router.navigate(['action-selection'], { state: { example: 'bar' } });
...
constructor(private router: Router) {
  console.log(this.router.getCurrentNavigation().extras.state.example); 
  // should log out 'bar'
}
Posted by: Guest on December-08-2020
0

pass parameter in route angular

//pass params

this.router.navigate([`admin/showProduct/${catKey}/${subcat_key}/${key}`])

//get params 

  constructor(  private route:ActivatedRoute ) {
  
    this.catkey =this.route.snapshot.paramMap.get('catkey');
  }
Posted by: Guest on April-09-2022

Code answers related to "how to pass parameter to router.navigate in angular"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language