Does angular2 support nested states/routes?

Suresh Reddy Guntaka picture Suresh Reddy Guntaka · Jan 24, 2016 · Viewed 30k times · Source

Does angular2 support nested states/routes? for example in a view port there are 2 links and on clicking a specific link it will present a view which with further have more than one link but that are specific to earlier link.

Answer

ThomasP1988 picture ThomasP1988 · Jul 20, 2016

With the new version of the router, If you want to use nested routes, here is an example on how to define the path

{
    path: 'search',
    component: SearchComponent,
    children: [
        { path: 'results/:id',  component: ResultsComponent },
    ]
}

and in your SearchComponent template, add <router-outlet></router-outlet>