title: Angular 2 Property subscribe does not exist on type Promise <any>
body: <p>I have imported 'rxjs/add/operator/toPromise'; </p>
  
  <p>In my Ts file i have something like:</p>
  
  <pre><code>onChange(categoryid) {
  //console.log('testing')
  this.productService.getProductsOncategory(categoryid).subscribe(data =&gt; {
    if (data.success) {
  
      console.log('Products obtained');
    } else {
      console.log('Not obtained!');
    }
   });
  }
  </code></pre>
  
  <p>I get error:</p>
  
  <blockquote>
    <p>Property 'subscribe' does not exist on type 'Promise'.</p>
  </blockquote>
  
  <pre><code>getProductsOncategory(category_id) {
  
  let catUrl = "API URL"
  let headers = new Headers();
  headers.append('Content-Type', 'application/json');
  let catIdObj = JSON.stringify({ category_id: category_id })
  return this.http.post(catUrl, catIdObj, { headers: headers })
    .toPromise()
    .then((response: Response) =&gt; response.json().data)
    //.map((response: Response) =&gt; response.json())
    //.do(data =&gt; console.log(JSON.stringify(data)))
    .catch(this.handleError);
  </code></pre>
  
  <p>}</p>
  
  <p>How to i change the snippet if i have to use ' then(data => '...</p>