Angular directive
map-lazy-load source
Description
Requires: Delay the initialization of map directive until the map is ready to be rendered Restrict To: Attribute
Parameters
Name | Type | Description |
---|---|---|
Attr2Options | service |
convert html attribute to Google map api options |
Attributes
Name | Type | Description |
---|---|---|
map-lazy-load | String |
Maps api script source file location. Example: 'https://maps.google.com/maps/api/js' |
map-lazy-load-params | String |
Maps api script source file location via angular scope variable. Also requires the map-lazy-load attribute to be present in the directive. Example: In your controller, set $scope.googleMapsURL = 'https://maps.google.com/maps/api/js?v=3.20&client=XXXXXenter-api-key-hereXXXX' |
Example
Example:
<div map-lazy-load="http://maps.google.com/maps/api/js">
<map center="Brampton" zoom="10">
<marker position="Brampton"></marker>
</map>
</div>
<div map-lazy-load="http://maps.google.com/maps/api/js"
map-lazy-load-params="{{googleMapsUrl}}">
<map center="Brampton" zoom="10">
<marker position="Brampton"></marker>
</map>
</div>