Get parent url parameter
<p>I have this routing</p>

<pre><code>import { ModuleWithProviders} from '@angular/core';
import {Routes, RouterModule} from '@angular/router';
import { AppComponent } from './app.component';
import { ChildComponent } from './app.child-component';
import { Child2Component } from './child2-component';


const appRoutes: Routes = [
    {
        path: '',
        redirectTo: 'AppComponent',
        pathMatch: 'full'
    },
    {
        path: ':lang',
        children:
        [
            {
                path: '',
                component: ChildComponent
            },
            {
                path: 'Child2Component',
                component: Child2Component
            }
        ]
    }
];

export const appRouting: ModuleWithProviders = RouterModule.forRoot(appRoutes);
</code></pre>

<p>I want to get that lang parameter from my function which looks:</p>

<pre><code>translateThis(lang: any) {

    // this line works fine
    this.translate.use(lang);

    // this doesn't
    this.sub = this.route.parent.queryParams.subscribe(
    (param: any) =&gt; {
        let lang = param['lang'];
        console.log(param);
        console.log(userId);
    });

}
</code></pre>

<p>but it stops working as soon i uncomment this.sub code (whole 6 lines). without that it works ok</p>

<pre><code>translateThis(lang: any) {
    this.translate.use(lang);
}
</code></pre>

<p>How can I get that lang value? I tried <code>params</code> as well instead of queryParams but result is same</p>