<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'"
doCluster="map.ClusterMarkers" clusterOptions="map.clusterOptions">
</ui-gmap-markers>
</ui-gmap-google-map>
</div>
</div>
</div>
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) {
angular.extend($scope, {
map: {
center: {
latitude: 35.681382,
longitude: 139.766084
},
options: {
maxZoom: 20,
minZoom: 3
},
zoom: 15,
Markers: [
{
latitude: 35.681,
longitude: 139.766,
id:1
},
{
latitude: 35.683,
longitude: 139.766,
id:2
},
{
latitude: 35.679,
longitude: 139.765,
id:3
},
{
latitude: 35.682,
longitude: 139.769,
id:4
}
],
ClusterMarkers: true,
clusterOptions: {
title: 'Cluster Markers',
gridSize: 60,
ignoreHidden: true,
minimumClusterSize: 2
}
}
});
uiGmapGoogleMapApi.then(function(maps) {});
}]);