Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DrawingManager for Maps #18599

Closed
mirnpnh opened this issue Feb 24, 2020 · 3 comments
Closed

DrawingManager for Maps #18599

mirnpnh opened this issue Feb 24, 2020 · 3 comments

Comments

@mirnpnh
Copy link

mirnpnh commented Feb 24, 2020

Documentation Feedback

Couldn't find any information in regard to how to use DrawingMananger with Maps component.
I have tried following snippet but it neither works or throws any error:

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);

I have already added libraries=drawing in maps import of index.html too.

https://stackblitz.com/edit/angular-vvwbdg

@mirnpnh mirnpnh added the docs This issue is related to documentation label Feb 24, 2020
@philip-firstorder
Copy link

philip-firstorder commented Apr 16, 2020

You must use the ngAfterViewInit function instead of ngOnInit, to give time for the google map to render in the DOM first.

@mmalerba mmalerba added the needs triage This issue needs to be triaged by the team label May 20, 2020
@crisbeto crisbeto added area: google-maps and removed docs This issue is related to documentation needs triage This issue needs to be triaged by the team labels May 29, 2020
@crisbeto
Copy link
Member

I can confirm that switching it to ngAfterViewInit resolve the issue. Closing since the component seems to work as expected.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jun 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants