title: Ionic 2 manual reload to get Data
body: <p>I am using a service to fetch the products from <code>woocommerce</code>. In the constructor of the service, I make an HTTP get call which fetches products and subscribe to the local data variable.Then I created a function <code>getData()</code> in the service which returns this fetched data to <code>myPage</code>. Then from <code>myPage</code>, I make a call to the <code>getData()</code> function from the constructor of my Component page and assign it to the local products array. <br>
  The problem is that when my page gets loaded initially the data is not yet received/subscribed by the HTTP get call inside my service constructor so the <code>getData()</code> function call returns null array and I have to reload the component page manually after the data have been received in the service to get the data in my page. </p>
  
  <p>Any idea what I am doing wrong here? and possible solution for that. <br>
  Thanks.  </p>
  
  <p>Here is my code.  </p>
  
  <pre><code> Service is fetching data from woocommerce.
  
  
   constructor(public http: Http) {
   console.log("itemservice constructor called")
   this.http.get(`${this.producturl}`).map(res=&gt;&lt;Product[]&gt;res.json()).subscribe(prods =&gt;{
      console.log("inside subscribe");
      this.items=prods;
    });
    getData(){
       return this.items;
    }
  </code></pre>
  
  <p>Code for page which is calling getData()</p>
  
  <pre><code>constructor(public nav: NavController, public categoryService: 
  CategoryService, public itemService: ItemService, public loadingCtrl: 
  LoadingController) 
  {
      console.log("home page constructor");
      this.items = this.itemService.getData();
  }
  </code></pre>