Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions src/google-maps/map-advanced-marker/README.md
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.
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last sentence deleted.

Copy link
Contributor Author

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.


**Note:** Use of `map-advanced-marker` requires a `google-map` whth a valid `mapId`.

## 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>
```
Loading