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.
ActivatedRouteSnapshot can also be used to traverse the router state tree.
Instead of “href” attribute of anchor tag, we use the “routerLink” attribute of Angular. The routerLink attribute allows us to link to a specific route of the Application.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With