title: Ionic pass value from app.component.ts to remote-service.ts using http service
body: <p>I have created a Dynamic Menu in ionic project and for each menu item I have to pass the API call to fetch the selected page-data. </p>
  
  <ol>
  <li>I have passed the ID of the menu clicked from <code>app.component.ts</code> to <code>remote-service.ts</code>. </li>
  <li>I need to fetch the data from the WordPress DB and i have found the API calls method. </li>
  </ol>
  
  <p><strong>app.html</strong></p>
  
  <pre><code>&lt;button menuClose ion-item *ngFor="let p of menuinformations" (click)="openApage(p.id)"&gt;
     {{p.title.rendered}}
  &lt;/button&gt;
  </code></pre>
  
  <p>Here <code>menuinformations</code> contains the JSON array of the pages that are to be displayed in the menu.  </p>
  
  <p><a href="https://i.stack.imgur.com/alIwb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/alIwb.png" alt="enter image description here"></a></p>
  
  <p><strong>app.component.ts</strong></p>
  
  <pre><code>openApage(pageinfo) {
   var pagedetails = this.service.getSinglePage(pageinfo).subscribe(
      data =&gt; {
          this.pageinformations = data
      });
   console.log(pagedetails);
      this.nav.push(AboutusPage, {
          pageinfodetails: pagedetails
      });
  }
  </code></pre>
  
  <p><strong>remote-service.ts</strong></p>
  
  <pre><code>getSinglePage(pageinfo)
    {
      let options = new RequestOptions({ headers: this.headers })
      let URL ="http://your-domain.com/wp-json/wp/v2/pages/"+pageinfo;
      return this.http.get(URL).map(res =&gt; res.json());
    }
  </code></pre>
  
  <p>I am successfully getting the page ID to the <code>remote-service.ts</code> file. But unable to fetch the data from the api response. </p>
  
  <p>When i paste the <strong>URL</strong> in the browser it fetches the data as JSON Format. </p>
  
  <p>My need is that when I click on the menu an API call needs to be made and the data is to be fetched so what can i do for that. </p>