How to pass result of foreach loop to functinon LatLng using angular 7 ?
- this.partDetailsService.getLocationData(locationArr).subscribe(res => {
- console.log(res);
- res.forEach((item, index) => {
- var dataLocation = res[index]['_source']['GPS1'];
- console.log(dataLocation);
- var locationsLatLng = dataLocation.split(',');
- console.log(locationsLatLng);
-
-
- });
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
- const coordinates = new google.maps.LatLng(lat value, lng value);