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);

Laxmidhar SahooRank #383 · 6.6K reputationPosted Jan 1, 2020, 6:11 PM EST
ahmed elbarbaryRank #1,060 · 1.8K reputationPosted Jan 1, 2020, 7:16 PM EST
Laxmidhar SahooRank #383 · 6.6K reputationPosted Jan 2, 2020, 3:50 AM EST