title: POST calls with Ionic 2
body: <p>I've been struggling a bit with implementing a POST call to an ASP.NET API with Ionic 2. I managed a GET with the help of a useful guide, but I couldn't really find anything similar for POST, until I came across a YouTube video. With the help of that video, I have this method in my provider:</p>
  
  <pre><code> backendlogin() {
    if (this.data) {
        return Promise.resolve(this.data);
    }
  
    return new Promise(resolve =&gt; {
        var json = JSON.stringify({ email: 'a@hotmail.com', password: 'root' });
        var params = 'json=' + json;
        var headers = new Headers();
        headers.append('Content-Type', 'application/json');
  
        this.http.post('http://insertipadresshere/api/login',
            params, {
                headers: headers
            })
            .map(res =&gt; res.json())
            .subscribe(data =&gt; {
                this.data = data;
                resolve(this.data);
            },
            error =&gt; alert(error),
            () =&gt; console.log("Finished")
        );
    });
  }
  </code></pre>
  
  <p>My GET methods are basically what was provided by Ionic when creating the provider. They are similar to this code, except for the part where the variables are declared and the headers are appended, as well as http.get instead of post of course. </p>
  
  <p>This is the function I use to call the function of the provider from the controller of the page:</p>
  
  <pre><code>setuplogin() {
      this.backend.backendlogin()
          .then(data =&gt; {
              this.data = data;
          });
      console.log(this.data);
  } 
  </code></pre>
  
  <p>Now on to the issue. If I understand everything, backendLogin() should display an alert with the error if something fails, which it does. The alert says "[object Object]". The only thing in the console is an empty log, presumably from setupLogin() because data is empty. The api should take an email adress and a password and return a uID. Can anyone point me in the right direction?</p>