title: how to get data from url in Angular 7
body: <p>I used the One component For many page in angular.
  I want to send a parameter from each component for show any different data.
  So I used the this code for call each component in Html:</p>
  
  <pre><code>&lt;a  [routerLink]="['categories']" &gt;Page1&lt;/a&gt;
  &lt;a  [routerLink]="['categories']" &gt;Page2&lt;/a&gt;
  </code></pre>
  
  <p>Now in routes i Used this code</p>
  
  <pre><code>  {path:'Page1' ,component : ProductCategoriesPagesComponent ,data : {PageNo : 1}},
    {path:'Page2' ,component : ProductCategoriesPagesComponent,data : {PageNo : 2}}
  </code></pre>
  
  <p>Then I used this code in <em>ProductCategoriesPagesComponent</em></p>
  
  <pre><code>ngOnInit() {
      this.route.data
          .subscribe(data =&gt; {
            console.log("data",data);
          });
  }
  </code></pre>
  
  <p>But i get </p>
  
  <pre><code>data {}
  </code></pre>
  
  <p>In console.
  Please Help me how I get parameters from routes 
  If I mistake, show the best way for this method.
  Thanks.</p>