60 lines
2.3 KiB
HTML
Executable File
60 lines
2.3 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.google.com/maps/api/js?sensor=false"></script>
|
|
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.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/directives/info-window.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("RectangleEventCtrl", function($scope, $compile) {
|
|
$scope.ne, $scope.sw;
|
|
$scope.boundsChanged = function(event) {
|
|
$scope.ne = this.getBounds().getNorthEast();
|
|
$scope.sw = this.getBounds().getSouthWest();
|
|
console.log('$scope', $scope);
|
|
$scope.showInfoWindow(event, 'foo', $scope.ne);
|
|
};
|
|
});
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
Rectangle Event<br/>
|
|
This example adds a user-editable rectangle to the map.
|
|
When the user changes the bounds of the rectangle,
|
|
an info window pops up displaying the new bounds.
|
|
<div ng-controller="RectangleEventCtrl">
|
|
<map zoom="9" center="44.5452, -78.5389">
|
|
<shape name="rectangle"
|
|
editable="true"
|
|
draggable="true"
|
|
bounds="[[44.490,-78.649],[44.599,-78.443]]"
|
|
on-bounds_changed="boundsChanged()">
|
|
</shape>
|
|
<info-window id="foo">
|
|
<div ng-non-bindable>
|
|
<b>Rectangle moved.</b><br/>
|
|
New north-east corner: {{ne.lat()}}, {{ne.lng()}}<br/>
|
|
New south-west corner: {{sw.lat()}}, {{sw.lng()}}
|
|
</div>
|
|
</info-window>
|
|
</map>
|
|
<b>Rectangle moved.</b><br/>
|
|
New north-east corner: {{ne.lat()}}, {{ne.lng()}}<br/>
|
|
New south-west corner: {{sw.lat()}}, {{sw.lng()}}
|
|
</div>
|
|
</body>
|
|
</html>
|