title: Angular 2 new Router: How to get router parameters of a child component?
body: <p>In the latest version of <code>@angular/router</code> <code>3.0.0-rc.1</code> The way you get the parameters from a URL/route changed.</p>
  
  <p>Based on <a href="https://angular.io/docs/ts/latest/guide/router.html#!#query-parameters" rel="noreferrer">this</a> documentation you should be able to get the params by subscribing to the params but in my case it seems that is not working.</p>
  
  <p>What I want to achieve is to get params into my parent component FROM child routes.</p>
  
  <p>For example let's say this is my routes:</p>
  
  <pre><code>const routes: Routes = [
    {
      path: 'parent',
      component: ParentComponent,
      pathMatch: 'prefix',
      children: [
        {
          path: ':id',
          component: ChildComponent
        }
      ]
    }
  ];
  </code></pre>
  
  <p>I want to get the <code>id</code> parameter and use it in my ParentComponent.
  So I'm trying like this:</p>
  
  <pre><code>export class ParentComponent implements OnInit {
  
    sub: any;
    constructor(
      private route: ActivatedRoute) {
      this.route = route;
     }
  
    ngOnInit() {
  
      this.sub = this.route.params.subscribe(params =&gt; {
       let id = params['id'];
       console.log(id);
     });
  
    }
  
  }
  </code></pre>
  
  <p>Like this I'm getting:</p>
  
  <blockquote>
    <p>Undefined</p>
  </blockquote>
  
  <p>What am I missing here?</p>