Implementation of MapController
Initialize a Google map within a <div>
tag with given options and register events
It accepts children directives; marker, shape, or marker-clusterer
It initialize map, children tags, then emits message as soon as the action is done The message emitted from this directive is; . mapInitialized
Dependencies:
Name | Type | Description |
---|---|---|
Attr2Options | Converts html attributes to Google map options |
|
$timeout | Angular window.setTimeout wrapper |
|
$parse | Angular html parser |
Attributes:
Name | Type | Description |
---|---|---|
geo-callback | 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 | The center of map incase geolocation failed. i.e. [0,0] |
|
zoom-to-include-markers | If true, map boundary will be changed automatially to include all markers when initialized |
|
default-style | When false, the default styling, |
|
init-event | The name of event to initialize this map.
If this option is given, the map won't be initialized until the event is received.
To invoke the event, use $scope.$emit or $scope.$broacast.
i.e. |
|
<MapOption> | ||
<MapEvent> |
Example
Usage:
<map MAP_OPTIONS_OR_MAP_EVENTS ..>
... Any children directives
</map>
<map center="[40.74, -74.18]" on-click="doThat()">
</map>
<map geo-fallback-center="[40.74, -74.18]" zoom-to-inlude-markers="true">
</map>
Methods
-
linkFunc (scope, element, attrs, ctrl)
-
Initialize map and events
Parameters:
Name Type Description scope the scope of this element
element element that this direcive is assigned to
attrs attribute of this element
ctrl map controller