angularangular-routerangular-routerlinkangular-new-router

Angular route and child route management


Somebody can tell me if is possible to open a child route in a new view instead of opening right under it? If so how and how to comeback to the father route previous state of navigation?


Solution

  • Instead of

    const routes: Routes = [
       { path: 'first', component: ExampleComponent, children: [
           { path: 'second', component: Example2Compoennt, }
       ] }
    ];
    

    Do:

    const routes: Routes = [
       { path: 'first', component: ExampleComponent },
       { path: 'first/second', component: Example2Compoennt },
    ];