I have the following code:
var headers = new Headers();
// headers.append('Content-Type', 'application/json');
headers.append('Content-Type', 'application/x-www-form-urlencoded');
this.http.post(
'http://192.168.1.45:3000/testrestapi',
{headers: headers}
).map((res => res.json())
.subscribe(data => {
// we've got back the raw data, now generate the core schedule data
// and save the data for later reference
this.data = data;
console.log('Friends Provider was a success!');
console.log(JSON.stringify(data));
resolve(this.data);
},
(err)=>{
console.log('Error in Friends Provider!');
},
()=>{
console.log('Friends Provider network call has ended!');
}
)
)
});
The code compiles fine without error, but I get the following errors in my ide:
I am following this docs: https://angular.io/docs/js/latest/api/http/Http-class.html . It shows how to use HTTP for GET, but not for POST. It seems I am missing the type for my headers which I am unsure what to put here as well it complains about the type for the subscribe method and again I am unsure what to put here as I am following the docs and it does not seem to have anything different?
