Angular Google Maps - automatically set 'center' and 'zoom' to fit in all markers

前端 未结 5 1629
暗喜
暗喜 2021-02-19 05:51

I have a dynamically generated list of markers within my Google Map. I want the map\'s center to be the center of all the markers and zoomed out just enough so that all markers

5条回答
  •  悲&欢浪女
    2021-02-19 06:29

    The answer has been posted for another problem: https://stackoverflow.com/a/23690559/5095063 After that you have just to add this line:

    $scope.map.control.getGMap().fitBounds(bounds);
    

提交回复
热议问题