Map Markers
Markers identify locations on the map. Angular Google Maps provides components for both standard and advanced markers.MapMarker (Deprecated)
TheMapMarker component wraps the google.maps.Marker class.
Note: As of 2024, Google Maps has deprecated the Marker class. Consider using MapAdvancedMarker instead.
Source: /home/daytona/workspace/source/src/google-maps/map-marker/README.md
Basic Usage
MapMarker Inputs
position(google.maps.LatLngLiteral | google.maps.LatLng) - Marker positiontitle(string) - Tooltip text on hoverlabel(string | google.maps.MarkerLabel) - Label displayed on markerclickable(boolean) - Whether marker is clickable. Default:trueoptions(google.maps.MarkerOptions) - Full marker options
MapMarker Outputs
mapClick- Marker is clickedmapDblclick- Marker is double-clickedmapRightclick- Marker is right-clickedmapDrag- Marker is being draggedmapDragend- Marker drag endsmapDragstart- Marker drag startsmapMouseover- Mouse enters markermapMouseout- Mouse leaves markerpositionChanged- Marker position changestitleChanged- Marker title changes
Custom Marker Icons
Draggable Markers
MapAdvancedMarker (Recommended)
The advanced marker provides more customization options and better performance.Basic Usage
MapInfoWindow
Display information in a popup when clicking markers.Basic Usage
MapInfoWindow Inputs
options(google.maps.InfoWindowOptions) - Info window configurationposition(google.maps.LatLngLiteral | google.maps.LatLng) - Position (if not attached to marker)
MapInfoWindow Outputs
closeclick- Info window is closedcontentChanged- Content changesdomready- DOM is readypositionChanged- Position changeszindexChanged- Z-index changes
MapMarkerClusterer
Group nearby markers into clusters for better performance with many markers.Cluster Options
Best Practices
- Use Advanced Markers when possible for better performance and features
- Cluster markers when displaying many markers (>100)
- Lazy load marker data for large datasets
- Optimize marker icons by using appropriate image sizes
- Reuse info windows instead of creating multiple instances
- Remove markers when zooming out to reduce clutter