123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <!DOCTYPE html>
- <html ng-app="myApp">
- <head>
- <title>Dynamic ngMap demo</title>
- <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
- <script src="https://maps.google.com/maps/api/js?sensor=false"></script>
- <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.5/angular.js"></script>
- <!-- build:js scripts/ng-map.min.js -->
- <script src="../app/scripts/app.js"></script>
- <script src="../app/scripts/directives/map_controller.js"></script>
- <script src="../app/scripts/directives/map.js"></script>
- <script src="../app/scripts/directives/marker.js"></script>
- <script src="../app/scripts/directives/shape.js"></script>
- <script src="../app/scripts/services/geo_coder.js"></script>
- <script src="../app/scripts/services/navigator_geolocation.js"></script>
- <script src="../app/scripts/services/attr2_options.js"></script>
- <!-- endbuild -->
- <script src="https://rawgit.com/allenhwkim/angularjs-google-maps/master/testapp/scripts/markers.js"></script>
- <script src="https://rawgit.com/allenhwkim/angularjs-google-maps/master/testapp/scripts/markerclusterer.js"></script>
- <script>
- var app = angular.module('myApp', ['ngMap']);
- app.controller('mapController', function($scope, $http, $interval) {
- var map;
- $scope.dynMarkers = [];
- $scope.$on('mapInitialized', function(event, evtMap) {
- map = evtMap;
- for (var i=0; i<1000; i++) {
- var latLng = new google.maps.LatLng(markers[i].position[0], markers[i].position[1]);
- $scope.dynMarkers.push(new google.maps.Marker({position:latLng}));
- }
- $scope.markerClusterer = new MarkerClusterer(map, $scope.dynMarkers, {});
- });
- });
- </script>
- <style>
- map, div[map] {display:block; width:600px; height:400px;}
- </style>
- </head>
- <body>
- <h1>Marker Cluster</h1>
- <hr />
-
- <div ng-controller="mapController">
- <map zoom="2" center="[43.6650000, -79.4103000]"></map>
- </div>
- </body>
- </html>
|