*How to collect all latitude and longitude from foreach loop on one 
variable after loop finish ?*


   
 lati: string;   



    longi: string; 

    this.partDetailsService.getLocationData(locationArr).subscribe(res => { 
                                         

    res.forEach((item, index) => 

    { 

    var dataLocation = res[index]['_source']['GPS1'];                       

    var loc = dataLocation.split(',');  

    this.lati = loc[0].trim(); //return 50   

    this.longi = loc[1].trim(); // return 100  

     });  


 


collectionlnglat =   



52,70   

30,40  

20,60   

50,100 


*collectionlnglat is variable store collect latitude,longtude from foreach*


*How to store all latitude and longtude for every iteration on variable 
collectionlnglat ?*


*first iteration 52,70*


*second iteration 30,40*


*third iteration 20,60*


*four iteration 50,100*


*collectionlatlng = 52,70 30,40 20,60 50,100*

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/angular/6167f61a-06ca-4daf-9f3c-be0fb00e25f6%40googlegroups.com.

Reply via email to