-
Notifications
You must be signed in to change notification settings - Fork 6.8k
docs(google-maps/map-advanced-marker): README.md added #29898
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# MapAdvancedMarker | ||
|
||
The `MapAdvancedMarker` component wraps the [`google.maps.marker.AdvancedMarkerElement` class](https://developers.google.com/maps/documentation/javascript/reference/advanced-markers) from the Google Maps JavaScript API. The `MapAdvancedMarker` component displays a marker on the map when it is a content child of a `GoogleMap` component. Like `GoogleMap`, this component offers an `options` input as well as convenience inputs for `title`, `position`, `content`, `gmpDraggable` and `zIndex`, and supports all `google.maps.marker.AdvancedMarkerElement` events as outputs. | ||
|
||
**Note:** Use of `map-advanced-marker` requires a `google-map` whth a valid `mapId`. | ||
|
||
K0n4ta13 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
## Example | ||
|
||
```typescript | ||
// google-map-demo.component.ts | ||
import {Component} from '@angular/core'; | ||
import {GoogleMap, MapAdvancedMarker} from '@angular/google-maps'; | ||
|
||
@Component({ | ||
selector: 'google-map-demo', | ||
templateUrl: 'google-map-demo.html', | ||
imports: [GoogleMap, MapAdvancedMarker], | ||
}) | ||
export class GoogleMapDemo { | ||
center: google.maps.LatLngLiteral = {lat: 24, lng: 12}; | ||
zoom = 4; | ||
advancedMarkerOptions: google.maps.marker.AdvancedMarkerElementOptions = {gmpDraggable: false}; | ||
advancedMarkerPositions: google.maps.LatLngLiteral[] = []; | ||
|
||
addAdvancedMarker(event: google.maps.MapMouseEvent) { | ||
this.advancedMarkerPositions.push(event.latLng.toJSON()); | ||
} | ||
} | ||
``` | ||
|
||
```html | ||
<!-- google-map-demo.component.html --> | ||
<google-map | ||
mapId="yourMapId" | ||
height="400px" | ||
width="750px" | ||
[center]="center" | ||
[zoom]="zoom" | ||
(mapClick)="addAdvancedMarker($event)"> | ||
@for (position of advancedMarkerPositions; track position) { | ||
<map-advanced-marker [position]="position" [options]="advancedMarkerOptions" /> | ||
} | ||
</google-map> | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can drop the last sentence here. We shouldn't list out the individual inputs/outputs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last sentence deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for splitting this into two commits. I accidentally left the outputs and the options part in the first one.