title: Getting parent route parameters in Angular 2 (router v3.0.0-alpha.6)
body: <p>Looking to set up a site using one of <a href="https://support.google.com/webmasters/answer/182192?hl=en" rel="nofollow noreferrer">Google's recommended practices for multi-regional and multilingual websites</a>, particularly the model of utilizing subdirectories with gTLD's (ex. www.stackoverflow.com/en/questions/ask, www.stackoverflow.com/fr/questions/ask, etc).  </p>
  
  <p>Depending on the top-level subdirectory I'd like to set default language and fetch the appropriate JSON data. To futher explain, when a user navigates directly to <a href="http://www.mywebsite.com/en/home" rel="nofollow noreferrer">www.mywebsite.com/en/home</a> the default language will be set to <code>en</code> and my content service will fetch the <code>en.json</code> file.  </p>
  
  <p>In the example above my routes would be configured like so:  </p>
  
  <pre><code>export const routes: RouterConfig = [
    { path: ':country',          component: Home },
    { path: ':country/home',     component: Home },
    { path: ':country/about',    component: About },
    { path: ':country/contact',  component: Contact }
  ];
  </code></pre>
  
  <p>I'm trying to figure out how to grab the <code>:country</code> route parameter (if URL is <a href="http://www.mywebsite.com/en/about" rel="nofollow noreferrer">www.mywebsite.com/en/about/</a> I'm trying to get the <code>:country</code> route parameter value of <code>en</code>) when in the <code>Home</code>, <code>About</code>, or <code>Contact</code> component. Here's a couple of things I've tried:  </p>
  
  <pre><code>export class Home implements OnInit {
      constructor(
          private route: ActivatedRoute
      ) {}
  
      private sub: any;
  
      ngOnInit(){
         this.sub = this.route.params.subscribe(params =&gt; {
           let country = params['country'];
           console.log(country) // undefined :(
         });
      }
  }
  </code></pre>
  
  <p>I've also tried using <code>route.snapshot</code> like so:  </p>
  
  <pre><code>export class Home implements OnInit {
      constructor(
          private route: ActivatedRoute
      ) {}
  
      ngOnInit(){
          let country = this.route.snapshot.params['country'];
          console.log(country) // undefined :(
      }
  }  
  </code></pre>
  
  <p>Also have tried working with this solution to no avail: <a href="https://stackoverflow.com/questions/34906888/angular-2-access-parent-routeparams-from-child-component">Angular 2 access parent routeparams from child component</a>  </p>
  
  <p>If anyone has an idea of another approach please share!</p>