Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.

Commit 4e38075

Browse files
authored
fix(AgmMarker): match Marker iconUrl input type to native api
allow AgmMarker `iconUrl` to be a GoogleSymbol or an Icon type. fixes: #1740 fixes: #1622 fixes: #1580 probably fixes a bunch more, since this was often requested.
1 parent d2ef77c commit 4e38075

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

packages/core/directives/marker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export class AgmMarker implements OnDestroy, OnChanges, AfterContentInit, FitBou
7272
/**
7373
* Icon (the URL of the image) for the foreground.
7474
*/
75-
@Input() iconUrl: string;
75+
@Input() iconUrl: string | mapTypes.MarkerIcon | mapTypes.GoogleSymbol;
7676

7777
/**
7878
* If true, the marker is visible

packages/core/map-types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export {
1010
LatLngLiteral,
1111
PolyMouseEvent,
1212
MarkerLabel,
13+
MarkerIcon,
1314
Geocoder,
1415
GeocoderAddressComponent,
1516
GeocoderComponentRestrictions,
@@ -42,6 +43,7 @@ export {
4243
RectangleOptions,
4344
Marker,
4445
MarkerOptions,
46+
GoogleSymbol,
4547
} from './services/google-maps-types';
4648

4749
/**

packages/core/services/google-maps-types.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export interface Marker extends MVCObject {
5151
setTitle(title: string): void;
5252
setLabel(label: string | MarkerLabel): void;
5353
setDraggable(draggable: boolean): void;
54-
setIcon(icon: string): void;
54+
setIcon(icon: string | MarkerIcon | GoogleSymbol): void;
5555
setOpacity(opacity: number): void;
5656
setVisible(visible: boolean): void;
5757
setZIndex(zIndex: number): void;
@@ -66,7 +66,7 @@ export interface MarkerOptions {
6666
map?: GoogleMap;
6767
label?: string | MarkerLabel;
6868
draggable?: boolean;
69-
icon?: string;
69+
icon?: string | MarkerIcon | GoogleSymbol;
7070
opacity?: number;
7171
visible?: boolean;
7272
zIndex?: number;
@@ -82,6 +82,15 @@ export interface MarkerLabel {
8282
text: string;
8383
}
8484

85+
export interface MarkerIcon {
86+
anchor?: Point;
87+
labelOrigin?: Point;
88+
origin?: Point;
89+
scaledSize?: Size;
90+
size?: Size;
91+
url: string;
92+
}
93+
8594
export interface Circle extends MVCObject {
8695
getBounds(): LatLngBounds;
8796
getCenter(): LatLng;

0 commit comments

Comments
 (0)