Home:ALL Converter>Dynamic path routing with angular

Dynamic path routing with angular

Ask Time:2022-06-22T18:22:40         Author:Jenifer K

Json Formatter

im new to angular ... i try to build new angular project with dynamic urls ..... mydomain name is xxx.yyy.com after this url i give dynamic name like xxx.yyy.com/name1, xxx.yyy.com/name2,xxx.yyy.com/name3 etc.,

if i give this xxx.yyy.com/name1 url in browser means it gets all my data...i used homecomponent for this like..{ path: '', component: HomeComponent, children: [ { path: '**', component: HomeComponent} ]} ....if i want to search any product means this urls should come with xxx.yyy.com/name1/search/ i created seperate component for search like product-list component ... i try this path for routing

{ path:':string/search',component:ProductListComponent}

it not goes to productlist page ... it shows home page only

i tried this url navigation to go for serach page from home page

`this.router.navigate([name1+'/search'])`..    

i get first segment for name1 and redirect to search using onclick method...how to go to productlist component page with dynamic url which i want.. thanks in advance...!

Author:Jenifer K,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/72713729/dynamic-path-routing-with-angular
yy