Skip to content

Commit 29c7844

Browse files
committed
- testing issue angular-ui#21 seems invalid
- debug example using two maps - fixed $log.error in map
1 parent 999f99f commit 29c7844

File tree

6 files changed

+78
-23
lines changed

6 files changed

+78
-23
lines changed

dist/angular-google-maps.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2608,7 +2608,7 @@ Nick Baugh - https://github.com/niftylettuce
26082608
settingCenterFromScope = true;
26092609
if (!dragging) {
26102610
if ((newValue.latitude == null) || (newValue.longitude == null)) {
2611-
$log.error("Invalid center for newVa;ue: " + (JSON.stringify(newValue)));
2611+
$log.error("Invalid center for newValue: " + (JSON.stringify(newValue)));
26122612
}
26132613
if (isTrue(attrs.pan) && scope.zoom === _m.zoom) {
26142614
_m.panTo(coords);

dist/angular-google-maps.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/debug-controller.js

+27
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ function DebugController($scope, $timeout, $log, $http) {
2222

2323
angular.extend($scope, {
2424
map:{
25+
control:{},
2526
center: {
2627
latitude: 45,
2728
longitude: -74
@@ -45,8 +46,34 @@ function DebugController($scope, $timeout, $log, $http) {
4546
navigationControl: false,
4647
scrollwheel: false,
4748
scaleControl: false
49+
},
50+
refresh: function(){
51+
$scope.map.control.refresh(origCenter);
52+
}
53+
},
54+
map2:{
55+
control:{},
56+
center: {
57+
latitude: 70,
58+
longitude: -76
59+
},
60+
marker: {
61+
latitude: 70,
62+
longitude: -76,
63+
options:{
64+
visible:true
65+
}
66+
},
67+
marker2: {
68+
latitude: 50.2,
69+
longitude: -80.5
70+
},
71+
zoom: 7,
72+
refresh: function(){
73+
$scope.map2.control.refresh({latitude:32.779680,longitude:-79.935493});
4874
}
4975
}
5076
});
5177

78+
var origCenter = {latitude:$scope.map.center.latitude,longitude:$scope.map.center.longitude};
5279
}

example/debug.html

+46-18
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<script src="https://rawgithub.com/aFarkas/html5shiv/3.7.0/src/html5shiv.js"></script>
1919
<![endif]-->
2020

21-
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet"
21+
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet"
2222
type="text/css">
2323
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,800,600,300,700'
2424
rel='stylesheet' type='text/css'>
@@ -28,28 +28,56 @@
2828
<body ng-controller="DebugController">
2929
<!-- You can use either a div having class 'google-map' or the '<google-map>' element; in
3030
the latter case, uncomment the style above to make sure the custom elements gets block display -->
31-
<div class="page-title affix">
32-
<h2>angular-google-maps example {{version}}</h2>
33-
</div>
34-
<div class="container-fluid">
35-
<div class="row-fluid">
36-
<div class="span7">
37-
<google-map class="affix span7"
38-
center="map.center"
39-
zoom="map.zoom"
40-
options="map.options"
41-
dragging="map.dragging"
42-
draggable="true">
43-
<marker coords="map.marker" options="map.marker.options"></marker>
44-
<marker coords="map.marker2" ></marker>
45-
</google-map>
46-
</div>
31+
<div class="page-title ">
32+
<h2 ng-cloak>angular-google-maps example {{version}}</h2>
4733
</div>
34+
<div class="container">
35+
<div class="row">
36+
<button class="col-md-2 btn btn-success" ng-click="map.refresh()">Refresh Map</button>
37+
<div class="col-md-4"></div>
38+
<button class="col-md-2 btn btn-success" ng-click="map2.refresh()">Refresh Map2</button>
39+
</div>
40+
<div class="row">
41+
<google-map class="col-md-6"
42+
center="map.center"
43+
zoom="map.zoom"
44+
options="map.options"
45+
dragging="map.dragging"
46+
draggable="true"
47+
control="map.control"
48+
>
49+
<marker coords="map.marker" options="map.marker.options"></marker>
50+
<marker coords="map.marker2">
51+
<window isIconVisibleOnClick="true">
52+
<p ng-cloak>Marker , MAP 1 Clicked on me2!</p>
53+
</window>
54+
</marker>
55+
</google-map>
56+
57+
<google-map class="col-md-6"
58+
center="map2.center"
59+
zoom="map2.zoom"
60+
dragging="map2.dragging"
61+
draggable="true"
62+
control="map2.control"
63+
>
64+
<marker coords="map2.marker" options="map2.marker.options">
65+
<window isIconVisibleOnClick="true">
66+
<p ng-cloak>Clicked on me!</p>
67+
</window>
68+
</marker>
69+
<marker coords="map2.marker2">
70+
<window isIconVisibleOnClick="true">
71+
<p ng-cloak>Marker 2Clicked on me2!</p>
72+
</window>
73+
</marker>
74+
</google-map>
75+
</div>
4876
</div>
4977
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
5078
<script src="http://maps.googleapis.com/maps/api/js?libraries=weather,visualization&sensor=false&language=en&v=3.13"></script>
5179
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.js"></script>
52-
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
80+
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
5381
<script src="http://underscorejs.org/underscore.js" type="text/javascript"></script>
5482
<script src="../dist/angular-google-maps.js"></script>
5583
<script src="mock-heat-layer.js"></script>

example/example.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ <h2>angular-google-maps example <span ng-cloak>{{version}}</span></h2>
6969
templateParameter="map.templatedInfoWindow.templateParameter" ng-cloak>
7070
</window>
7171

72-
<marker coords="searchLocationMarker.coords" options="searchLocationMarker.options" events="searchLocationMarker.events" />
72+
<marker coords="searchLocationMarker.coords" options="searchLocationMarker.options" events="searchLocationMarker.events" >
73+
</marker>
7374

7475
<markers models="map.randomMarkers" coords="'self'" icon="'icon'" click="'onClicked'"
7576
doCluster="map.doClusterRandomMarkers" clusterOptions="map.clusterOptions">

src/coffee/directives/map.coffee

+1-2
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ angular.module("google-maps").directive "googleMap", ["$log", "$timeout", ($log,
185185
scope.control.refresh = (maybeCoords) =>
186186
return unless _m?
187187
google.maps.event.trigger _m, "resize" #actually refresh
188-
#do we have new coords to goto along with the refresh?
189188
if maybeCoords?.latitude? and maybeCoords?.latitude?
190189
coords = getCoords(maybeCoords)
191190
if isTrue(attrs.pan)
@@ -205,7 +204,7 @@ angular.module("google-maps").directive "googleMap", ["$log", "$timeout", ($log,
205204
settingCenterFromScope = true
206205
unless dragging
207206
if !newValue.latitude? or !newValue.longitude?
208-
$log.error("Invalid center for newVa;ue: #{JSON.stringify newValue}")
207+
$log.error("Invalid center for newValue: #{JSON.stringify newValue}")
209208
if isTrue(attrs.pan) and scope.zoom is _m.zoom
210209
_m.panTo coords
211210
else

0 commit comments

Comments
 (0)