I have the following issue: I have a http.post request to get json data from the server. It excecutes properly and when I log this.data in this method I get the required data. However, once I try to call this data, the method does not seem to fill it the way it should. I figured this much out, but not why or how to solve this.
authenticate(username, password) {
var creds = JSON.stringify({
UserName: username.value,
UserPassword: password.value,
SetDebug: true
});
var headers = new Headers();
headers.append('Content-Type', 'application/json');
// SERVER
this.http.post('http://demo/aariworx5/api/login/login', creds ,{headers: headers})
.subscribe(
res => {
this.data = res.json();
},
error => console.log(error)
);
}