Sometimes we need only a part the page in our app to change from one component to another, while we want the rest of the page to stay where it is.
Imagine you have a tab-view with multiple tabs and you want each tab to navigate independently of the whole page. You could try to hack that by adding all required components in each tab, then show and hide them with a clever *ngIf. However the moment you add a couple of these you realise that this wasn't such a clever approach after all.<router-outlet></router-outlet>
const routes: Routes = [
  { path: '', redirectTo: '/home/(catoutlet:cats//dogoutlet:dogs)', pathMatch: 'full' },
  { path: 'home', component: HomeComponent, children: [
    { path: 'cats', component: CatsComponent, outlet: 'catoutlet'},
    { path: 'cats/:name', component: CatDetailsComponent, outlet: 'catoutlet'},
    { path: 'dogs', component: DogsComponent, outlet: 'dogoutlet'},
    { path: 'dogs/:id', component: DogDetailsComponent, outlet: 'dogoutlet'}
  ]}
];
                          <ActionBar title="Nested Navigation" class="action-bar"></ActionBar>
<TabView class="tab-view">
<StackLayout *tabItem="{title: 'Cats'}">
<router-outlet name="catoutlet"></router-outlet>
</StackLayout>
<StackLayout *tabItem="{title: 'Dogs'}">
<router-outlet name="dogoutlet"></router-outlet>
</StackLayout>
</TabView>
Here is what you should expect:
 
                          <GridLayout rows="*, 2*" class="page">Here is what you should expect:
<StackLayout row="0">
<Label text="Cats" class="h2 text-center action-bar"></Label>
<router-outlet name="catoutlet"></router-outlet>
</StackLayout>
<StackLayout row="1">
<Label text="Dogs" class="h2 text-center action-bar"></Label>
<router-outlet name="dogoutlet"></router-outlet>
</StackLayout>
</GridLayout>

<ButtonNow we just need to create CatsDetailComponent, which will display the name of the cat and allow the user to navigate back.
text="Show Scratchy"
[nsRouterLink]="['/home', { outlets: { catoutlet: ['cats', 'Scratchy'] } } ]">
</Button>
<Button
text="Show Hissy"
[nsRouterLink]="['/home', { outlets: { catoutlet: ['cats', 'Hissy'] } } ]">
</Button>
<Button
text="Show Mystique"
[nsRouterLink]="['/home', {outlets: { catoutlet: ['cats', 'Mystique']}}]">
</Button>
ngOnInit() {
  this.name = this.route.snapshot.params['name'];
}
                          Then the CatDetailsComponent template should be rather simple.<Label [text]="'Hello ' + name"></Label>- display a back button which will use nsRouterLink to navigate back.
<Label text="Did you knock the plants off the window sill?" textWrap="true"></Label>
<ButtonAnd voila! That is all we need to do, to navigate inside catoutlet with nsRouterLink.
text="Go Back"
[nsRouterLink]="['/home', { outlets: { catoutlet: ['cats'] } } ]">
</Button>
navigateToDetails(id: number) {
  this.router.navigate([
    '/home', { outlets: { dogoutlet: ['dogs', id] } }
  ])
}
                          Then in the DogsComponent template we just need to create a list view and add an on tap event that will call navigateToDetails.<ListView [items]="dogs" class="list-group" height="100%">
<template let-item="item" >
<Label
(tap)="navigateToDetails(item.id)"
[text]="item.name"
class="list-group-item">
</Label>
</template>
</ListView>
goBack() {
  this.router.navigate([
    '/home', { outlets: { dogoutlet: ['dogs'] } }
  ])
}
                          Then in DogsDetailsComponent template we just need to:<Label [text]="dog.name"></Label>- add back button:
<Label text="Who is the good doggie?"></Label>
<Label [text]="'Max Weight:' + dog.maxWeight + ' inches'"></Label>
<Label [text]="'Max Height:' + dog.maxHeight + ' pounds'"></Label>
<Button text="Go Back" (tap)="goBack()"></Button>
                            You can also navigate to more than one outlet in a single call.
                            Just simply provide all outlets you want to update in the outlet param.
                            For examle we can add a reset button that will navigate to the default of cats and dogs views just do it like this:
                          
<Button
text="Reset"
[nsRouterLink]="['/home', { outlets: { catoutlet: ['cats'], dogoutlet: ['dogs'] } } ]">
</Button>
                            You can find the whole solution in my github
                            nativescript-nested-router