title: Getting a Route parameter in an Angular child component
body: <p>I'm unable to get a routing parameter from a child component in my Angular 6 application</p>
  
  <p>I have the following routes set up in app-routing.module:</p>
  
  <pre><code>{
      path: 'item/:id',
      component: ItemLayoutComponent,
      children: [
          { path: '', redirectTo: 'inbox',  pathMatch: 'full' },
          { path: 'inbox', loadChildren: './feature/inbox/inbox.module#InboxModule' }
      ]
  },
  </code></pre>
  
  <p>And then this in my inbox-routing-module.ts:</p>
  
  <pre><code>{
      path: '',
      component: InboxComponent,
      children: [
          { path: '', redirectTo: 'messages',  pathMatch: 'full' },
          {
              path: 'messages', component: MessagesComponent
          },
      ]
  }
  </code></pre>
  
  <p>This allows me to have a url that looks like this to get to my messages component:</p>
  
  <pre><code>item/5200/inbox/messages
  </code></pre>
  
  <p>My problem is that in my ItemLayoutComponent I can get the value of the id field (in this case 5200) with the following code:</p>
  
  <pre><code>this.route.snapshot.paramMap.get('id')
  </code></pre>
  
  <p>However I need the value of this ID in my MessagesComponent.  Currently the same code gives me null.</p>