An AngularJS directive to quickly insert Google Static Maps.
I was inspired by angular-google-staticmaps that seems is no longer mantained.
bower install --save ng-google-static-maps- Include dependencies in your HTML.
- Load the
tbc.ngGoogleStaticMapsmodule for your Angular app. - Use the
static-google-mapdirective.
<static-google-map size="137x137" markers="markers" sensor="false" zoom="14"></static-google-map>The markers attribute can contain one or multiple markers.
Markers have the following format:
$scope.markers = [{
color: 'blue',
label: 'S',
coords: [lat, lng],
icon: YOUR_ICON_URL
}];If markers change, the directive will refresh itself automatically.
Any attribute is directly passed to the generated URL the image is loaded from,
except for markers, which gets formatted according to the specification.
The size attribute is required and must be specified as WIDTHxHEIGHT whereby WIDTH
denotes the width and pixels and HEIGHT the height.
The sensor attribute must explicitly be set to either true or false.
MIT