forked from wbyoko/angularjs-google-maps-components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path01-Hello-Maps.html
43 lines (37 loc) · 1.29 KB
/
01-Hello-Maps.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.1.0/pure-min.css">
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
<title>wbyoko - Hello Maps</title>
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0px; padding: 0px }
.google-map{width:100%; height:100%;}
</style>
</head>
<body ng-app="mapComponentsApp">
<h1>Hello Maps</h1>
<div class="google-map" hello-maps="" latitude="43.074688" longitude="-89.384294"></div>
<script type="text/javascript">
var mapApp = angular.module('mapComponentsApp', []);
mapApp.directive('helloMaps', function () {
return function (scope, elem, attrs) {
var mapOptions,
latitude = attrs.latitude,
longitude = attrs.longitude,
map;
latitude = latitude && parseFloat(latitude, 10) || 43.074688;
longitude = longitude && parseFloat(longitude, 10) || -89.384294;
mapOptions = {
zoom: 8,
center: new google.maps.LatLng(latitude, longitude)
};
map = new google.maps.Map(elem[0], mapOptions);
};
});
</script>
</body>
</html>