I am using AGM maps for my angular 4 application, there I am facing issues, I will be having the multiple markers which are fetched from api as an array of Latitude and Long
I got it to work with the LatLngBounds() function. Here is the snippet.
import {AgmInfoWindow, MapsAPILoader} from '@agm/core';
latlngBounds: any;
// fits the map to the bounds
if (this.points.length.) {
this.mapsAPILoader.load().then(() => {
this.latlngBounds = new window['google'].maps.LatLngBounds();
_.each(this.points, location => {
this.latlngBounds.extend(new window['google'].maps.LatLng(location.lat, location.lng));
});
}
);
}