我如何通过邮件获取数据。我需要帮助。我的代码:
getmapdetail(){
return new Promise(resolve => {
this.http.post(this.apiUrl, JSON.stringify({id:3})).subscribe(data =>{
resolve(data);
},err =>{
console.log(err);
});
})
}
// considering this is in some service
getmapdetail(){
return this.http.post(this.apiUrl, JSON.stringify({id:3})).map(data => data.json());
}
// inject that service in component
// call that service from component like this
this.service.getmapdetail().subscribe(data => {
// do what ever you want with data
})