title: Angular 7/8 - How to get url parameters in app component
body: <p>I have Single sign on in place but for testing I want to read the values from the url <code>localhost:4200/?id=test&amp;name=testing&amp;email=testing@test.com</code> and pass them to an API in app component.</p>
  
  <p>there will be a flag on which basis I will reading from url instead of using single sign on function</p>
  
  <pre><code>if (url_enabled == true) {
      getParamsFromUrl()
   } else {
     singleSignOn()
   }
  </code></pre>
  
  <p>I tried ActivatedRoute but it doesn't seem to be working. </p>
  
  <p>I have tried <code>queryParams, params, url, queryParamsMap</code> but none of these seems to be working. all I get is empty value.</p>
  
  <p>inside app component </p>
  
  <p>app.component.ts</p>
  
  <pre><code> getParamsFromUrl() {
      this._router.events.subscribe((e) =&gt; {
        if (e instanceof NavigationEnd) {
          console.log(e.url)
        }
      })
    }
  
   this.route.queryParams.subscribe(params =&gt; {
        console.log(params);
      })
  </code></pre>
  
  <p>app.component.html</p>
  
  <pre><code>&lt;router-outlet&gt;&lt;/router-outlet&gt;
  </code></pre>
  
  <p>app-routing.module.ts</p>
  
  <pre><code>const routes: Routes = [
    {path:'*/:id', component: AppComponent},
  ];
  </code></pre>
  
  <p>I have tried whatever I could found on stackoverflow or other blogs. Can somebody point out what am I missing here?</p>