app-routing.module.ts
const routes: Routes = [
{ path: 'products', component: ProductsComponent },
{ path: 'product/:id', component: ProductDetailsComponent },
{ path: '', redirectTo: '/products', pathMatch: 'full' },
];
In controller you can navigate like this,
this.router.navigate(['/products', productId]);
It will land you to path like this: http://localhost:4200/products/product-id