Totally new to angular 2 and having issues with capturing the results of http calls. The calls are simple and only return json with a success/fail and a message. I've started using promises for these calls and can display the results in the browser, but cannot log or alert with the results. Let me know if you need more info.
Service:
deleteTsUser(params){
var url = this.userDeleteUrl + '?' + params.toString();
return this.http.get(url)
.toPromise()
.then(this.extractData)
.catch(this.handleError);
}
Component:
var result = this._tsUserService.deleteTsUser(params)
.then(
r => {
this.result.result = r.result,
this.result.messages = r.messages
}
);
console.log('RES: ' + this.result.result)
Template:
{{ result.result }} :: {{ result.messages }}
Results display properly in template, but that console.log message just logs "Res:"...why isn't this working? I'm missing something really basic, right? Thx in adv.