Skip to content

Commit 23872e8

Browse files
author
Allen Kim
committed
added more examples
1 parent 4353d8f commit 23872e8

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

directives/info-window.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
*
1111
* Restrict To: Element
1212
*
13+
* NOTE: this directive should **NOT** be used with `ng-repeat` because InfoWindow itself is a template,
14+
* and must be reused by each marker, thus, should not be redefined by `ng-repeat`.
15+
*
1316
* @attr {Boolean} visible Indicates to show it when map is initialized
1417
* @attr {Boolean} visible-on-marker Indicates to show it on a marker when map is initialized
1518
* @attr {Expression} geo-callback if position is an address, the expression is will be performed when geo-lookup is successful. e.g., geo-callback="showDetail()"
@@ -101,6 +104,7 @@
101104

102105
var linkFunc = function(scope, element, attrs, mapController) {
103106
element.css('display','none');
107+
104108
var orgAttrs = parser.orgAttributes(element);
105109
var filtered = parser.filter(attrs);
106110
var options = parser.getOptions(filtered, scope);

testapp/directions-with-ng-repeat-panels.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
<div ng-repeat="dir in directions">
3434
<div style="width: 68%; float:left; height:450px">
3535
<map style="height:100%" >
36-
37-
<directions
36+
37+
<directions
3838
draggable="false"
3939
travel-mode="DRIVING"
4040
panel="{{dir.panelName}}"
@@ -45,7 +45,7 @@
4545
</div>
4646
<div id="{{dir.panelName}}" style="width: 32%; float:left; height:450px"></div>
4747
</div>
48-
48+
4949
</body>
5050

5151
</html>

testapp/directions.html

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@
1919
body {padding: 5px}
2020
* { box-sizing: border-box; }
2121
</style>
22+
<script>
23+
angular.module('ngMap').run(function($rootScope) {
24+
$rootScope.logLatLng = function(e) {
25+
console.log('loc', e.latLng);
26+
}
27+
$rootScope.wayPoints = [
28+
{location: {lat:44.32384807250689, lng: -78.079833984375}, stopover: true},
29+
{location: {lat:44.55916341529184, lng: -76.17919921875}, stopover: true},
30+
];
31+
});
32+
</script>
2233
</head>
2334
<body ng-app="ngMap">
2435
<div style="width: 68%; float:left; height: 100%">
@@ -44,12 +55,12 @@
4455
<option value="TRANSIT">Transit</option>
4556
</select>
4657

47-
<map zoom="14" center="37.7699298, -122.4469157" style="height:90%" >
58+
<map zoom="14" center="37.7699298, -122.4469157" style="height:90%" on-click="logLatLng()" >
4859
<directions
4960
draggable="true"
5061
panel="directions-panel"
5162
travel-mode="{{travelMode}}"
52-
waypoints="[{location:'kingston', stopover:true}]"
63+
waypoints="{{wayPoints}}"
5364
origin="{{origin}}"
5465
destination="{{destination}}">
5566
</directions>

testapp/directions2.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@
2424
<div style="width: 68%; float:left; height: 100%">
2525

2626
<map zoom="14" center="1135 Karamea-Kohaihai Rd, Kahurangi National Park, Tasman" style="height:90%" >
27-
<directions
27+
<directions
2828
draggable="true"
2929
panel="directions-panel"
3030
travel-mode="DRIVING"
3131
origin="1135 Karamea-Kohaihai Rd, Kahurangi National Park, Tasman"
3232
destination="Pier St, Jackson Bay, West Coast, New Zeland">
3333
</directions>
34-
</map>
34+
</map>
3535
Directions path length:
3636
{{map.directionsRenderers[0].directions.routes[0].overview_path.length}}
3737
</div>

0 commit comments

Comments
 (0)