I have been trying to use DrawingManager
with official Angular components wrapper of Maps API but it didn't worked as it should. If anyone could have made it work it I would be thankful to get a solution for this. Here is the snippet and stackblitz link for solution I tried but no luck. (In stackblitz it didn't recognized the google namespace but if you download it would be ok on local machine)
this.drawingManager = new google.maps.drawing.DrawingManager({
drawingMode: google.maps.drawing.OverlayType.POLYGON,
drawingControl: true,
drawingControlOptions: {
position: google.maps.ControlPosition.TOP_CENTER,
drawingModes: [google.maps.drawing.OverlayType.POLYGON]
}
});
this.drawingManager.setMap(this.map._googleMap);
https://stackblitz.com/edit/angular-vvwbdg
Github issue link: https://github.com/angular/components/issues/18599
Edit 1:
It turned out the issue is with map not being fully loaded and setting DrawingManager
before that doesn't takes effect. There is no load callback in the wrapper module. But AfterViewInit of Angular seems to do the job well.