how to create url base on category name / product name in angular

i want create url based on category name / subcatergory name/ product name

example : cold-drinks-juices/soft-drinks/cid/332/1102

if I redirect from category to product listing page then url will be like : catergory/categoryname/subcategory name

subcategory name will be added by product listing page.

i used this technique and its working but if do refresh then its not works.

const url = this.router.createUrlTree([‘subCateName’], {relativeTo: this.activatedRoute}).toString();

this._location.go(url);

please suggest me some solution.

i am trying to url for eCommerce website and i want use product or category name instead of product Id/mongoose it