50 lines
1.6 KiB
HTML
Executable File
50 lines
1.6 KiB
HTML
Executable File
<!DOCTYPE html>
|
|
<html ng-app="myApp">
|
|
<head>
|
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
|
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
|
|
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.5/angular.min.js"></script>
|
|
<script src="scripts/app.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>
|
|
var app = angular.module('myApp', ['ngMap']);
|
|
app.controller("PolylineComplexCtrl", function($scope) {
|
|
var poly = poly = new google.maps.Polyline({
|
|
strokeColor: '#000000',
|
|
strokeOpacity: 1.0,
|
|
strokeWeight: 3
|
|
});
|
|
$scope.$on('mapInitialized', function(evt, map) {
|
|
poly.setMap(map);
|
|
});
|
|
$scope.addMarkerAndPath = function(event) {
|
|
var path = poly.getPath();
|
|
var marker = new google.maps.Marker({
|
|
position: event.latLng,
|
|
title: "#"+ path.getLength(),
|
|
map: $scope.map
|
|
});
|
|
path.push(event.latLng);
|
|
}
|
|
});
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
<div ng-controller="PolylineComplexCtrl">
|
|
<map zoom="7" center="41.879535, -87.624333"
|
|
on-click="addMarkerAndPath()">
|
|
</map>
|
|
</div>
|
|
</body>
|
|
</html>
|