|
1 | 1 | <!DOCTYPE html> |
2 | 2 | <html ng-app="demoapp"> |
3 | 3 | <head> |
4 | | - <script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script> |
5 | | - <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.2/angular.min.js"></script> |
| 4 | + <script src="http://cdn.leafletjs.com/leaflet-0.7.1/leaflet.js"></script> |
| 5 | + <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js"></script> |
6 | 6 | <script src="../dist/angular-leaflet-directive.min.js"></script> |
7 | | - <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" /> |
| 7 | + <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.1/leaflet.css" /> |
8 | 8 | <script> |
9 | 9 | var app = angular.module("demoapp", ["leaflet-directive"]); |
10 | | - app.controller("DemoController", [ "$scope", "leafletData", function($scope, leafletData) { |
11 | | - angular.extend($scope, { |
12 | | - london: { |
13 | | - lat: 51.505, |
14 | | - lng: -0.09, |
15 | | - zoom: 4 |
16 | | - }, |
17 | | - bounds: { |
18 | | - southWest: { |
19 | | - lat:51.508742458803326, |
20 | | - lng: -0.087890625, |
21 | | - }, |
22 | | - northEast: { |
23 | | - lat:51.508742458803326, |
24 | | - lng:-0.087890625, |
25 | | - } |
26 | | - } |
27 | | - }); |
28 | | - leafletData.getMap().then(function(map){ |
| 10 | + app.controller("DemoController", [ "$scope", "leafletData", "leafletBoundsHelpers", function($scope, leafletData, leafletBoundsHelpers) { |
| 11 | + |
| 12 | + var bounds = leafletBoundsHelpers.createBoundsFromArray([ |
| 13 | + [ 51.508742458803326, -0.087890625 ], |
| 14 | + [ 51.508742458803326, -0.087890625 ] |
| 15 | + ]); |
| 16 | + |
| 17 | + angular.extend($scope, { |
| 18 | + london: { |
| 19 | + lat: 51.505, |
| 20 | + lng: -0.09, |
| 21 | + zoom: 4 |
| 22 | + }, |
| 23 | + bounds: bounds |
| 24 | + }); |
| 25 | + |
| 26 | + leafletData.getMap().then(function(map){ |
29 | 27 | var bounds = map.getBounds(); |
30 | 28 | console.log('northwest=' + bounds.getNorthWest().toString() + '&northeast=' + bounds.getNorthEast().toString() + '&southeast=' + bounds.getSouthEast().toString() + '&southwest=' + bounds.getSouthWest().toString()); |
31 | | - }); |
32 | | - }]); |
| 29 | + }); |
| 30 | + }]); |
33 | 31 | </script> |
34 | 32 | <style> |
35 | 33 | input { |
|
0 commit comments