title: How to get parameter from URL(Routing) Angular 2?
body: <p>I tried to do that in <code>ngOnInit()</code> like:</p>
  
  <pre class="lang-js prettyprint-override"><code>ngOnInit() {
      this.route.queryParams
        .filter(params =&gt; params.type)
        .subscribe(params =&gt; {
          this.tab = params.type;
          this.setHeader();
        });
    }
  </code></pre>
  
  <p>My URL is:</p>
  
  <pre class="lang-none prettyprint-override"><code>http://localhost:4200/s/6/t/p/create/1
  </code></pre>
  
  <p>Routing is:</p>
  
  <pre class="lang-js prettyprint-override"><code>{path: ':Id/t/p/create/:type', component: CalendarComponent},
  </code></pre>