<script type='text/javascript' src='http://www.example.com/wp/wp-content/themes/ang/js/lodash.underscore.min.js'></script>
<script type='text/javascript' src='http://www.example.com/wp/wp-content/themes/ang/js/angular-google-maps.min.js'></script>
<script type='text/javascript' src='http://www.example.com/wp/wp-content/themes/ang/js/app.js'></script>
<div ng-controller="MyCtrl">
<div class="row">
<div class="col-sm-12">
<ui-gmap-google-map id="map-canvas" center="map.center" zoom="map.zoom" draggable="true" options="map.options">
<ui-gmap-markers models="map.markers" coords="'self'"
options="'options'" icon="'icon'" isLabel='true' >
</ui-gmap-markers>
</ui-gmap-google-map>
</div>
</div>
</div>
var mapApp = angular.module('googleMapApp', ['google-maps'.ns(),'ui.bootstrap']);
mapApp.config(['GoogleMapApiProvider'.ns(), function (GoogleMapApi) {
GoogleMapApi.configure({
key: 'your Google Map api key',
v: '3.17',
libraries: ''
});
}]);
mapApp.controller("MyCtrl",['$scope', 'GoogleMapApi'.ns(), function ($scope,GoogleMapApi) {
angular.extend($scope, {
map: {
center: {
latitude: 35.681382,
longitude: 139.766084
},
options: {
maxZoom: 20,
minZoom: 3
},
zoom: 16,
markers: [
{
latitude: 35.681382,
longitude: 139.766084,
showWindow: false,
title: 'Tokyo Station',
id:1
},
{
latitude: 35.682032,
longitude: 139.762294,
showWindow: false,
title: 'wadakuramon',
id: 2
},
{
latitude: 35.678354,
longitude: 139.761028,
showWindow: false,
title: 'babasakimon',
id:3
}
]
}
});
angular.forEach($scope.map.markers, function (marker) {
marker.closeClick = function () {
marker.showWindow = false;
$scope.$apply();
};
marker.onClicked = function () {
marker.showWindow = true;
$scope.$apply();
};
});
}]);
I’m really appreciate for the example on the angular map functionality demo. It helped me so much. Thank you for the effort for putting it here. 🙂