ahmed elbarbary

ahmed elbarbary

  • NA
  • 1.6k
  • 254.5k

How to pass result of foreach loop to functinon LatLng?

Dec 30 2019 5:02 PM
How to pass result of foreach loop to functinon LatLng using angular 7 ?
  1. this.partDetailsService.getLocationData(locationArr).subscribe(res => {  
  2. console.log(res);  
  3. res.forEach((item, index) => {  
  4. var dataLocation = res[index]['_source']['GPS1'];  
  5. console.log(dataLocation);  
  6. var locationsLatLng = dataLocation.split(',');  
  7. console.log(locationsLatLng);  
  8.   
  9.   
  10. });  
I have foreach loop get GPS1 latitude and longitude from service return latitude and longitude based on array of locationsId then store it separated by comma , on variable locationsLatLng (lat,lng) as following :
52,70
30,40
20,60
50,100
I need to pass locationsLatLng to function latlng
  1. const coordinates = new google.maps.LatLng(lat value, lng value);  

Answers (3)