ActivatedRoute.queryParams is undefined
<p>I am trying to capture a querystring parameter using Angular 2.0 and am having a hard time. I have a url like so</p>

<p><a href="http://localhost:5000/?id_token=eyJ0eXAiO" rel="noreferrer">http://localhost:5000/?id_token=eyJ0eXAiO</a>....</p>

<p>And I want to be able to capture the value of id_token before routing takes hold and I lose the parameter. I found this GitHub Issue Thread</p>

<p><a href="https://github.com/angular/angular/issues/9451" rel="noreferrer">https://github.com/angular/angular/issues/9451</a></p>

<p>But this uses a deprecated method that no longer works. I have tried the following methods</p>

<pre><code>    var foo = this.activatedRoute.queryParams.subscribe(params =&gt; {
        console.log(params);
        let id = params['id_token'];
        console.log(id);
    });


   console.log(this.router.routerState.snapshot.root.queryParams["id_token"]);

   var bar = this.activatedRoute.params.subscribe(
        (param: any) =&gt; console.log(param['id_token']));
</code></pre>

<p>I have tried these methods in the constructor as well as ngOnInit() of my component, but the console always shows undefined. Am I doing this in the wrong place. I am not able to change the QS at all because it is being created by Azure AD.</p>