Angular2: API call return an error
<p>I'm using Angular2 to create a simple web application.
This application must call an API to get some datas.</p>

<p>I created a Service and a Component, as seen in the official tutorial.</p>

<p>The service:</p>

<pre><code>import { Injectable } from '@angular/core';
import { Headers, Http, Response } from '@angular/http';

import 'rxjs/add/operator/toPromise';

@Injectable()
export class WeatherService {

  private url : string = 'http://127.0.0.1:1337/weather';

  constructor(private http: Http) {
    console.log('Weather URL API:', this.url);
  }

  public getWeather() {
    return  this.http
            .get(this.url)
            .toPromise()
            .then(
              (response) =&gt; {
                console.log('response:',response);
              },
              (error) =&gt; {
                console.log('Error:',error);
              }
            );
  }

}
</code></pre>

<p>The problem is that this service always return an error:</p>

<blockquote>
  <p>Error: Object { _body: error, status: 0, ok: false, statusText: "", headers: Object, type: 3, url: null }</p>
</blockquote>

<p>But in the Mozilla Firefox development tools, the API is called and return JSON with status code 200.</p>

<p>Maybe I made a mistake, but I don't see what and where. An idea ?</p>