I want to achieve something like this /products
shows all the products and /products/:category
shows all the products related to a specific categor
you can solve it by adding routes
const routes: Routes = [
{ path: 'experience',
children: [
{ path: 'pending', component: ExperienceComponent },
{ path: 'requests', component: ExperienceComponent },
] }]
and in ExperienceComponent import
import { ActivatedRoute } from "@angular/router";
and in constructor add this parameter
constructor(public route: ActivatedRoute)
and inside constructor get url
this.route.url.subscribe(params => {
console.log(params[0].path);
})