i am using the following code to get distance between multiple address from a single location, after then i push the result to my html, which works fine...but i want to be able to get each distance for each user and also to display the closest users only.
data.forEach( (element) => {const distance = this.distanceInKmBetweenEarthCoordinates(this.Senderlat,this.Senderlng,parseFloat(element.lat),parseFloat(element.lng));
this.drivers.push(element);
});
I am using this to display the loop in my html file, which works well..but i need to sort the data by a field name of distance or item.distance so that the closest person comes up first before orders
<ion-item lines="none" *ngFor="let item of drivers>