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

Add input to control map marker icon #22097

Closed
mattstarkey opened this issue Mar 3, 2021 · 2 comments · Fixed by #22357
Closed

Add input to control map marker icon #22097

mattstarkey opened this issue Mar 3, 2021 · 2 comments · Fixed by #22357
Assignees
Labels
area: google-maps feature This issue represents a new feature or feature request rather than a bug or bug fix P4 A relatively minor issue that is not relevant to core functions

Comments

@mattstarkey
Copy link

mattstarkey commented Mar 3, 2021

I am struggling to find a way to update the MapMarker icon using @angular/google-maps.

Here is a Stackblits example of what I am trying to do:
Link to stackblits

So every 3 seconds I would like to change the marker to either green or blue, this is just simulating a real world scenario.

The documentation states that MapMarker component wraps the google.maps.Marker class, so I should be able to use the .setIcon() method, but I am unsure of how to access the google.maps.Marker class in this case.

In this issue: #21068

The response comments notes that in this case I should not have to create the google.Maps.Marker object which makes sense, but when I change the MapMarker object inside my markers array I also get no change.

Does anyone have any experience with this that could share a solution or point me in the right direction?

@crisbeto crisbeto added the needs triage This issue needs to be triaged by the team label Mar 8, 2021
@crisbeto
Copy link
Member

crisbeto commented Mar 8, 2021

It's because you have to provide a new options object when you want to swap out the icon. Here's a working example: https://stackblitz.com/edit/angular-2jlrcu?file=src%2Fapp%2Fapp.component.ts.

That being said, I think that it makes sense to control the icon independently from the options so I'll turn this into a feature request.

@crisbeto crisbeto changed the title How to update MapMarker icon Add input to control map marker icon Mar 8, 2021
@crisbeto crisbeto added area: google-maps feature This issue represents a new feature or feature request rather than a bug or bug fix P4 A relatively minor issue that is not relevant to core functions and removed needs triage This issue needs to be triaged by the team labels Mar 8, 2021
@crisbeto crisbeto self-assigned this Mar 27, 2021
crisbeto added a commit to crisbeto/material2 that referenced this issue Mar 27, 2021
Currently the only way to control the icon of a marker is through the `options` object which can be cumbersome. These changes add a dedicated `icon` input which can be used to only change the icon.

Fixes angular#22097.
crisbeto added a commit to crisbeto/material2 that referenced this issue Mar 30, 2021
Currently the only way to control the icon of a marker is through the `options` object which can be cumbersome. These changes add a dedicated `icon` input which can be used to only change the icon.

Fixes angular#22097.
annieyw pushed a commit that referenced this issue Apr 2, 2021
Currently the only way to control the icon of a marker is through the `options` object which can be cumbersome. These changes add a dedicated `icon` input which can be used to only change the icon.

Fixes #22097.
@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 May 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: google-maps feature This issue represents a new feature or feature request rather than a bug or bug fix P4 A relatively minor issue that is not relevant to core functions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants