This is my current code which is called when bounds are changed and works:
scope.boundsChanged= function(arg){
console.log(arg);
};
I basically need the new array of lat and lng when this function above is called.
I'm unsure are the retrieve it.
I'm using angular version 1 with JavaScript in a directive using a templateUrl.
Img of console log of bounds arg:
I dont know exactly what is returned in the boundsChanged() function, but assuming changed bounds are returned in the function, method is the same to get lat, lng coordinates:
scope.boundsChanged= function(arg){
//assuming changed bounds is returned as the 'arg'
var polygonBounds = arg;
var coordinates = [];
for (var i = 0; i < polygonBounds.length; i++)
{
coordinates.push({lat: polygonBounds.getAt(i).lat(), lng: polygonBounds.getAt(i).lng()});
coordinates.push(new google.maps.LatLng(polygonBounds.getAt(i).lat(), polygonBounds.getAt(i).lng()));
}
console.log(arg);
};