Himanshu Kumar
Himanshu Kumar

Reputation: 1

How to make custom url while using name router-outlet?

Here i don't want this (sidebar:cart-page) please help me?

enter image description here

I wanted to make inner cart component common while searching based on tag and also don't want (sidebar:cart-page)

enter image description here

enter image description here

Upvotes: 0

Views: 65

Answers (1)

Flo
Flo

Reputation: 3137

This is not possible. Angular need to know which router-outlet should be used. One way you can go is to use child-routes. Then you only have own router-outlet in the main component, and each child component has a router-outlet, too.

Example

const routes: Routes = [
  {
    path: 'first-component',
    component: FirstComponent, // this is the component with the <router-outlet> in the template
    children: [
      {
        path: 'child-a', // child route path
        component: ChildAComponent, // child route component that the router renders
      },
      {
        path: 'child-b',
        component: ChildBComponent, // another child route component that the router renders
      },
    ],
  },
];

And children can have children, two. So your route looks different and without the (sidebar:cart-page).

Upvotes: 0

Related Questions