title: Angular 4 Parent Router Outlet from Child Route
body: <p>I am trying to achieve a customizable navbar of sorts in my angular application.</p>
  
  <p>Here is my app.component template</p>
  
  <pre><code>&lt;nav class="navbar navbar-default navbar-fixed-top"&gt;  
    &lt;div class="container-fluid"&gt;
      &lt;div class="navbar-header"&gt;
        &lt;button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar"&gt;
          &lt;span class="icon-bar"&gt;&lt;/span&gt;
          &lt;span class="icon-bar"&gt;&lt;/span&gt;
          &lt;span class="icon-bar"&gt;&lt;/span&gt;
        &lt;/button&gt;
        &lt;a class="navbar-brand pageTitle"&gt;iMobile&lt;/a&gt;
      &lt;/div&gt;
        &lt;div class="collapse navbar-collapse" id="myNavbar"&gt;
            &lt;router-outlet name="navbar"&gt;&lt;/router-outlet&gt;  
  
            &lt;ul class="nav navbar-nav navbar-right" *ngIf="authenticated"&gt;
                &lt;li&gt;&lt;a [routerLink]="['/login']"&gt;&lt;span class="glyphicon glyphicon-log-out"&gt;&lt;/span&gt; Log Out&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
        &lt;/div&gt;
    &lt;/div&gt;
  &lt;/nav&gt;
  
  &lt;alert&gt;&lt;/alert&gt;
  &lt;router-outlet&gt;&lt;/router-outlet&gt; 
  </code></pre>
  
  <p>and here is my app.routing</p>
  
  <pre><code>import { Routes, RouterModule } from '@angular/router';
  
  import { AuthGuard } from './_guards/index';
  
  import { LoginComponent } from './login/index';
  
  // Reports section of the website
  import { ReportsComponent } from './reports/index';
  import { DashboardComponent } from './reports/dashboard/index';
  import { SampleComponent } from './reports/sample/index';
  
  // Corporate section of the website
  import { CorporateComponent } from './corporate/index';
  import { CorpNavbarComponent } from './corporate/corpNavbar/index';
  
  const appRoutes: Routes = [
      { path: 'login', component: LoginComponent },
      {
          path: 'reports', component: ReportsComponent, canActivate: [AuthGuard],
          children: [
              { path: '', redirectTo: 'dashboard', pathMatch: 'full' },
              { path: 'dashboard', component: DashboardComponent },
              { path: 'sample', component: SampleComponent }
          ]
      },
      {
          path: 'corporate', component: CorporateComponent, canActivate: [AuthGuard],
          children: [
              { path: '', component: CorpNavbarComponent, outlet: 'navbar'}
          ]
      }
  
  
      // otherwise redirect to home
      { path: '**', redirectTo: 'reports' }
  ];
  
  export const routing = RouterModule.forRoot(appRoutes);
  </code></pre>
  
  <p>What I would like, is to be able to replace the navigation portion of the navbar based on the section of the website. Is this possible?</p>