var mapApp = angular.module('googleMapApp', ['uiGmapgoogle-maps']);
mapApp.config(
['uiGmapGoogleMapApiProvider', function(GoogleMapApiProviders) {
GoogleMapApiProviders.configure({
key: 'your Google Map api key',
v: '3', //defaults to latest 3.X anyhow
libraries: 'weather,geometry,visualization'
});
}]
);
mapApp.controller("MyCtrl",['$scope', 'uiGmapGoogleMapApi', function ($scope,uiGmapGoogleMapApi) {
var onMarkerDblclickd = function (marker, eventName, args) {
$scope.map.zoom = 17;
$scope.map.center.latitude = marker.getPosition().lat();
$scope.map.center.longitude = marker.getPosition().lng();
$scope.$apply();
}
angular.extend($scope, {
map: {
center: {
latitude: 35.681382,
longitude: 139.766084
},
options: {
maxZoom: 20,
minZoom: 3
},
zoom: 15,
markers: [
{
latitude: 35.681382,
longitude: 139.766084,
showWindow: false,
id:1,
options: {
labelContent: 'Tokyo Station',
labelAnchor: '0 30'
},
events: {
dblclick: function (marker, eventName, args) {
onMarkerDblclickd(marker, eventName, args);
}
}
},
{
latitude: 35.682032,
longitude: 139.762294,
showWindow: false,
id: 2,
options: {
labelContent: 'wadakuramon',
labelAnchor: '0 30'
},
events: {
dblclick: function (marker, eventName, args) {
onMarkerDblclickd(marker, eventName, args);
}
}
},
{
latitude: 35.678354,
longitude: 139.761028,
showWindow: false,
id: 3,
options: {
labelContent: 'babasakimon',
labelAnchor: '0 30'
},
events: {
dblclick: function (marker, eventName, args) {
onMarkerDblclickd(marker, eventName, args);
}
}
}
]
}
});
uiGmapGoogleMapApi.then(function(maps) {});
}]);