I got a provider “fetchdata” to return promise
getPostDetail(id)
{
return new Promise(function(resolve, reject)
{
let link = 'https://themooncreation.com/apps/data2.php?action=get_posts&id='+id;
console.log(link);
this.http.get(link).map(res => res.json()).subscribe(data =>
{
// console.log("right here "+postDetail['USERNAME']);
resolve(data);
reject(console.log('some fail stuff'));
});
});
}
and i am calling the provider by
this.fetchdata.getPostDetail(this.id).then(post => this.loadMap(post['LAT'], post['LON']));
but seems loadMap is not being called, anyone know why?