Skip to content

Commit

Permalink
feat(AgmMap): add mapTypeId support
Browse files Browse the repository at this point in the history
You can now set the mapTypeId with an input named mapTypeId.

Closes #774
  • Loading branch information
sebholstein committed Jan 31, 2017
1 parent 52315b3 commit edf6e4f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/core/directives/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import {DataLayerManager} from './../services/managers/data-layer-manager';
'draggingCursor', 'keyboardShortcuts', 'zoomControl', 'zoomControlOptions', 'styles', 'usePanning',
'streetViewControl', 'streetViewControlOptions', 'fitBounds', 'mapTypeControl', 'mapTypeControlOptions',
'panControlOptions', 'rotateControl', 'rotateControlOptions', 'fullscreenControl', 'fullscreenControlOptions',
'scaleControl', 'scaleControlOptions'
'scaleControl', 'scaleControlOptions', 'mapTypeId'
],
outputs: [
'mapClick', 'mapRightClick', 'mapDblClick', 'centerChange', 'idle', 'boundsChange', 'zoomChange'
Expand Down Expand Up @@ -241,6 +241,11 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy {
*/
fullscreenControlOptions: FullscreenControlOptions;

/**
* The map mapTypeId. Defaults to 'roadmap'.
*/
mapTypeId: 'roadmap'|'hybrid'|'satellite'|'terrain'|string = 'roadmap';

/**
* Map option attributes that can change over time
*/
Expand All @@ -249,7 +254,8 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy {
'keyboardShortcuts', 'zoomControl', 'zoomControlOptions', 'styles', 'streetViewControl',
'streetViewControlOptions', 'zoom', 'mapTypeControl', 'mapTypeControlOptions', 'minZoom',
'maxZoom', 'panControl', 'panControlOptions', 'rotateControl', 'rotateControlOptions',
'fullscreenControl', 'fullscreenControlOptions', 'scaleControl', 'scaleControlOptions'
'fullscreenControl', 'fullscreenControlOptions', 'scaleControl', 'scaleControlOptions',
'mapTypeId'
];

private _observableSubscriptions: Subscription[] = [];
Expand Down Expand Up @@ -330,6 +336,7 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy {
rotateControlOptions: this.rotateControlOptions,
fullscreenControl: this.fullscreenControl,
fullscreenControlOptions: this.fullscreenControlOptions,
mapTypeId: this.mapTypeId
});

// register event listeners
Expand Down
1 change: 1 addition & 0 deletions src/core/services/google-maps-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export interface MapOptions {
rotateControlOptions?: RotateControlOptions;
fullscreenControl?: boolean;
fullscreenControlOptions?: FullscreenControlOptions;
mapTypeId?: string|MapTypeId;
}

export interface MapTypeStyle {
Expand Down

1 comment on commit edf6e4f

@robert-king
Copy link

Choose a reason for hiding this comment

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

example usage:
<agm-map [latitude]="lat" [longitude]="lng" [zoom]="16" [mapTypeId]="'satellite'">
<agm-marker [latitude]="lat" [longitude]="lng">

Please sign in to comment.