Angular directive
ng-map source
Description
Implementation of __MapController
Initialize a Google map within a <div>
tag
with given options and register events
Parameters
Name | Type | Description |
---|---|---|
Attr2Options | service |
convert html attribute to Google map api options |
Attributes
Name | Type | Description |
---|---|---|
map-initialized | Expression |
callback function when map is initialized e.g., map-initialized="mycallback(map)" |
geo-callback | Expression |
if center is an address or current location, the expression is will be executed when geo-lookup is successful. e.g., geo-callback="showMyStoreInfo()" |
geo-fallback-center | Array |
The center of map incase geolocation failed. i.e. [0,0] |
geo-location-options | Object |
The navigator geolocation options. e.g., { maximumAge: 3000, timeout: 5000, enableHighAccuracy: true }. If none specified, { timeout: 5000 }. If timeout not specified, timeout: 5000 added |
zoom-to-include-markers | Boolean |
When true, map boundary will be changed automatially to include all markers when initialized |
default-style | Boolean |
When false, the default styling,
|
<MapOption> | String |
Any Google map options, https://developers.google.com/maps/documentation/javascript/reference?csw=1#MapOptions |
<MapEvent> | String |
Any Google map events, https://rawgit.com/allenhwkim/angularjs-google-maps/master/build/map_events.html |
single-info-window | Boolean |
When true the map will only display one info window at the time, if not set or false, everytime an info window is open it will be displayed with the othe one. |
trigger-resize | Boolean |
Default to false. Set to true to trigger resize of the map. Needs to be done anytime you resize the map |
Example
Usage:
<map MAP_OPTIONS_OR_MAP_EVENTS ..>
... Any children directives
</map>
Example:
<map center="[40.74, -74.18]" on-click="doThat()">
</map>
<map geo-fallback-center="[40.74, -74.18]" zoom-to-inlude-markers="true">
</map>