Answers for "how to pass parameter in url to component in angular"

0

angular url parameter

// example url: details?id=2

constructor(private activatedRoute: ActivatedRoute) {
  this.activatedRoute.queryParams.subscribe(params => {
        console.log(params); // Prints {id: "2"}
    });
}
Posted by: Guest on February-24-2021
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 in url to component in angular"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language