title: Best practice of retrieving params and queryParams in Angular 2
body: <p>I'm trying to understand the way of creating a route, with some information in it's URL parameters. </p>
  
  <p>This is my route (app.routes.ts):</p>
  
  <pre><code>{path: 'results/:id', component: MyResultsComponent},
  </code></pre>
  
  <p>This is how I navigate to the route :</p>
  
  <pre><code>goToResultsPage(query: string) {
  this.router.navigate(['results', query], { queryParams: { pageSize: 20 } });}
  </code></pre>
  
  <p>As you can see, I've also a query parameter. I was wondering, what is the best and cleanest way to retrieve this in my <code>MyResultsComponent</code>. Right now I've kind of a nested <code>subscribe</code> structure:</p>
  
  <pre><code>ngOnInit() {
      this.route
        .params
        .subscribe(params =&gt; {
          this.query = params['id'];
          this.route
            .queryParams
            .subscribe(queryParams =&gt; {
              this.offset = queryParams['pageSize'];
              #find entries this.entryService.findEntries(this.query, this.pageSize);
        });
      });
    }
  </code></pre>
  
  <p>Afterwards, I want to pass this parameters to my <code>EntryService</code>, which returns the found entries.</p>