From 5ea076a3bdaa3fc65a1d00d23b2cae992bbdb590 Mon Sep 17 00:00:00 2001 From: K0n4ta13 <148166466+K0n4ta13@users.noreply.github.com> Date: Tue, 5 Nov 2024 03:05:15 -0700 Subject: [PATCH] docs(google-maps): add readme (#29898) * docs(google-maps/map-advanced-marker): README.md added * Update README.md Removed list of inputs and corrected spelling. * Update README.md (cherry picked from commit a2dc6576b9fa47ec1724e01212fb1715360c28b1) --- src/google-maps/map-advanced-marker/README.md | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/google-maps/map-advanced-marker/README.md diff --git a/src/google-maps/map-advanced-marker/README.md b/src/google-maps/map-advanced-marker/README.md new file mode 100644 index 000000000000..4f2177219546 --- /dev/null +++ b/src/google-maps/map-advanced-marker/README.md @@ -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. + +**Note:** Use of `map-advanced-marker` requires a `google-map` with 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 + + + @for (position of advancedMarkerPositions; track position) { + + } + +```