How to store value of latitude and longtude on two variables after finish loop ?

4 views
Skip to first unread message

ahmed elbarbary

unread,
Dec 30, 2019, 5:39:27 AM12/30/19
to Angular and AngularJS discussion
How to store values of loc[0].trim and loc[1].trim on two variables latitude and longitude 
and what type of two variables ?
 values of loc[0] and loc[1 already success retrieve values 
i need to store every loc on two variables after finish loop
this.partDetailsService.getLocationData(locationArr).subscribe(res => {    
                console
.log(res);  
        res
.forEach((item, index) => {  
            let dataLocation
= res[index]['_source']['GPS1'];    
            console
.log(dataLocation);    
            let loc
= dataLocation.split(',');    
            console
.log("After");    
            console
.log(loc);    success
            console
.log(loc[0].trim());   success
            console
.log(loc[1].trim());  success
     
             
     

   });  
latitude= result of loc[0].trim after loop finish
longitude= result of loc[1].trim after loop finish
and what datatype assigned to two variables ?
 
 


Reply all
Reply to author
Forward
0 new messages