Hi Mahmoud,

Because your service is async. This means that it returns a promise. a 
promise will not be resolved right away, but on the at first, next cycle.
that means that:

this.eventService.getEvents(lat, lon, range, s).then(events => this.eventsList 
= events /*<== this runs in the future */ ); 
console.log(this.eventsList);// <== this will run before the promise is 
settled.

Regards
Sander

-- 
You received this message because you are subscribed to the Google Groups 
"Angular" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to