Seeking Assistance on Sending an Array of Location IDs to a Service
I currently have an array consisting of location IDs.
locationArr=[40871, 60009, 38149, 40868, 43240, 15299, 53897, 40976, 38151, 23183, 38152, 78579, 23180, 40977, 23176, 39565, 40884, 15298, 38147, 40966, 39669]
I am in need of passing this locationArr array to
The purpose is to send the array of location IDs present in locationArr to a service in order to retrieve the latitude and longitude coordinates for each location ID within that array.
The current situation is that the service can only fetch the data for one location ID at a time. Therefore, my query is about how to handle an array of location IDs efficiently.
getLocationData(id: number) {
console.log("server "+id)
return this.http.get('http://192.168.7.45:9200/location/_doc/'+id);
}
Hence, I would greatly appreciate guidance on how to accomplish this using a loop through the array of locations.
Calling the service
this.partDetailsService.getLocationData(this.LocationId).subscribe(res => {
this.dataLocation = res['_source']['GPS1'];
var loc = this.dataLocation.split(',');
this.lat = loc[0].trim();
this.lng = loc[1].trim();