I think you can use arrays, with the same index
On Tue, 31 Dec 2019 at 12:41 PM, ahmed elbarbary <[email protected]>
wrote:
> *How to collect all latitude and longitude from foreach loop on one
> variable after loop finish ?*
>
>
>
> lati: string;
>
>
>
> longi: string;
>
> this.partDetailsService.getLocationData(locationArr).subscribe(res =>
> {
>
> res.forEach((item, index) =>
>
> {
>
> var dataLocation = res[index]['_source']['GPS1'];
>
>
> var loc = dataLocation.split(',');
>
> this.lati = loc[0].trim(); //return 50
>
> this.longi = loc[1].trim(); // return 100
>
> });
>
>
>
>
>
> collectionlnglat =
>
>
>
> 52,70
>
> 30,40
>
> 20,60
>
> 50,100
>
>
> *collectionlnglat is variable store collect latitude,longtude from foreach*
>
>
> *How to store all latitude and longtude for every iteration on variable
> collectionlnglat ?*
>
>
> *first iteration 52,70*
>
>
> *second iteration 30,40*
>
>
> *third iteration 20,60*
>
>
> *four iteration 50,100*
>
>
> *collectionlatlng = 52,70 30,40 20,60 50,100*
>
> --
> You received this message because you are subscribed to the Google Groups
> "Angular and AngularJS discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/angular/6167f61a-06ca-4daf-9f3c-be0fb00e25f6%40googlegroups.com
> <https://groups.google.com/d/msgid/angular/6167f61a-06ca-4daf-9f3c-be0fb00e25f6%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
Sent from Gmail Mobile
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/angular/CAMF%2BC3oeu0Qrc%3DMCgSRMeb8YPJ%2B3vTysAP0VKHYX1J4C%3DsF9-g%40mail.gmail.com.