in following code, I want to return the value but it returns an object:
code :
this.count = count(post.id);
console.log(this.count);
.
.
.
count(id,url){
return new Promise(resolve =>
this.http.get(url)
.map(res => res.json())
.subscribe(data => {
console.log(data.count);// it shows 3 and is correct
resolve(data.count);
}));
}
the console output is something like :
{__zone_symbol__state: null, __zone_symbol__value: Array(0)}
__zone_symbol__state:true
__zone_symbol__value:3
how can I solve this?