Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70440

Function return value in object t and value stored in __zone_symbol__value:

$
0
0

@rsa wrote:

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?

Posts: 3

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 70440

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>