Skip to content

Commit 06fda08

Browse files
committed
new build
1 parent 95d61f7 commit 06fda08

File tree

13 files changed

+290
-157
lines changed

13 files changed

+290
-157
lines changed

build/docs/NgMap.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ <h5>Parameters:</h5>
390390
</dd>
391391
</dl><dl>
392392
<dt>
393-
<a href="source/NgMap.html#line149" class="name-link">
393+
<a href="source/NgMap.html#line157" class="name-link">
394394
<h4 class="name">
395395
observeAndSet
396396
<span class="signature">(attrName, object)</span>
@@ -441,7 +441,7 @@ <h5>Returns:</h5>
441441
</dd>
442442
</dl><dl>
443443
<dt>
444-
<a href="source/NgMap.html#line203" class="name-link">
444+
<a href="source/NgMap.html#line211" class="name-link">
445445
<h4 class="name">
446446
setDefaultOptions
447447
<span class="signature">(options)</span>
@@ -481,7 +481,7 @@ <h5>Parameters:</h5>
481481
</dd>
482482
</dl><dl>
483483
<dt>
484-
<a href="source/NgMap.html#line178" class="name-link">
484+
<a href="source/NgMap.html#line186" class="name-link">
485485
<h4 class="name">
486486
setStyle
487487
<span class="signature">(map)</span>

build/docs/index.html

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -175,18 +175,12 @@ <h1 class="title">
175175
<h1>GoogleMap AngularJS Directive</h1><!--
176176
[![Build Status](https://travis-ci.org/allenhwkim/angularjs-google-maps.png?branch=master)](https://travis-ci.org/allenhwkim/angularjs-google-maps)
177177
-->
178+
<p><a href="https://ngmap.github.io">Demo</a><br><a href="https://rawgithub.amrom.workers.dev/allenhwkim/angularjs-google-maps/master/build/docs/index.html">Documentation</a><br><a href="https://rawgit.com/allenhwkim/angularjs-google-maps/master/testapp/street-view_road_trip.html">Road Trip By StreetView</a><br><a href="https://rawgit.com/allenhwkim/angularjs-google-maps/master/testapp/custom-marker.html">Maps Can Talk</a> |
179+
<a href="https://rawgit.com/allenhwkim/angularjs-google-maps/master/testapp/custom-marker-2.html">Custom Marker</a> </p>
178180
<h2>IMPORTANT NOTICE</h2><ul>
179-
<li><code>$scope.map</code> is deprecated. Use <code>NgMap.getMap().then(function(map) {...})</code>
180-
instead to get a map instance.</li>
181-
<li><code>$scope.$on('mapInitialized', function(event, map) {..}</code> is deprecated.
182-
Use <code>NgMap.getMap().then(function(map) {...})</code> instead to get a map instance.</li>
183-
<li><code>$scope.showInfoWindow(id)</code> is deprecated. <code>map.showInfoWindow(id)</code> instead.
184-
You need to get map instance usng <code>NgMap.getMap().then()</code> in advance.</li>
185-
<li><code>map</code> tag is deprecated. Use <code>ng-map</code> tag instead</li>
181+
<li>Implementation for Angular2 version has been started at <a href="https://github.com/ng2-ui/ng2-map">https://github.com/ng2-ui/ng2-map</a></li>
186182
</ul>
187-
<p><a href="http://ngmap.github.io">Demo</a><br><a href="https://rawgithub.amrom.workers.dev/allenhwkim/angularjs-google-maps/master/build/docs/index.html">Documentation</a><br><a href="https://rawgit.com/allenhwkim/angularjs-google-maps/master/testapp/street-view_road_trip.html">Road Trip By StreetView</a><br><a href="https://rawgit.com/allenhwkim/angularjs-google-maps/master/testapp/custom-marker.html">Maps Can Talk</a> |
188-
<a href="https://rawgit.com/allenhwkim/angularjs-google-maps/master/testapp/custom-marker-2.html">Custom Marker</a> </p>
189-
<p>There is already <a href="https://github.com/nlaplante/angular-google-maps">one</a> for this. However, I found myself doing totally different approach than the existing one, such as;</p>
183+
<h2>Background</h2><p>There is already <a href="https://github.com/nlaplante/angular-google-maps">one</a> for this. However, I found myself doing totally different approach than the existing one, such as;</p>
190184
<ol>
191185
<li><p><strong>Everything in tag and attributes.</strong><br>Thus, basic users don't even have to know what Javascript is. </p>
192186
</li>

build/docs/js/prettify.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ var prettyPrint;
649649
* recognized.
650650
*
651651
* Shortcut is an optional string of characters, any of which, if the first
652-
* character, guarantee that this pattern and only this pattern matches.
652+
* character, gurantee that this pattern and only this pattern matches.
653653
*
654654
* @param {Array} shortcutStylePatterns patterns that always start with
655655
* a known character. Must have a shortcut string.
@@ -932,7 +932,7 @@ var prettyPrint;
932932
// preprocessor directives.
933933

934934
// This definition of punctuation does not include # in the list of
935-
// follow-on exclusions, so # will not be broken before if preceded
935+
// follow-on exclusions, so # will not be broken before if preceeded
936936
// by a punctuation character. We could try to exclude # after
937937
// [|&;<>] but that doesn't seem to cause many major problems.
938938
// If that does turn out to be a problem, we should change the below

build/docs/places-auto-complete.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ <h5>Attributes:</h5>
223223
<h5>Example</h5>
224224
<pre class="prettyprint"><code><span class="str">Example:
225225
&lt;script src="https://maps.googleapis.com/maps/api/js?libraries=places">&lt;/script>
226-
&lt;input places-auto-complete types="['geocode']" on-place-changed="myCallback(place)" /></span></code></pre>
226+
&lt;input places-auto-complete types="['geocode']" on-place-changed="myCallback(place)" component-restrictions="{country:'au'}"/></span></code></pre>
227227
</div>
228228
</dd>
229229
</div>

build/docs/source/NgMap.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,14 @@ <h1 class="title">
302302
deferred.reject(error);
303303
}
304304
);
305+
// var geocoder = new google.maps.Geocoder();
306+
// geocoder.geocode(options, function (results, status) {
307+
// if (status == google.maps.GeocoderStatus.OK) {
308+
// deferred.resolve(results);
309+
// } else {
310+
// deferred.reject(status);
311+
// }
312+
// });
305313
}
306314
return deferred.promise;
307315
};

build/docs/source/info-window.html

Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ <h1 class="title">
222222
/* global google */
223223
(function() {
224224
'use strict';
225-
var infoWindow = function(Attr2MapOptions, $compile, $timeout, $parse, NgMap) {
225+
var infoWindow = function(Attr2MapOptions, $compile, $q, $templateRequest, $timeout, $parse, NgMap) {
226226
var parser = Attr2MapOptions;
227227
var getInfoWindow = function(options, events, element) {
228228
var infoWindow;
@@ -242,30 +242,45 @@ <h1 class="title">
242242
}
243243
}
244244
/**
245-
* set template ane template-relate functions
245+
* set template and template-related functions
246246
* it must have a container element with ng-non-bindable
247247
*/
248-
var template = element.html().trim();
249-
if (angular.element(template).length != 1) {
250-
throw "info-window working as a template must have a container";
251-
}
252-
infoWindow.__template = template.replace(/\s?ng-non-bindable[='"]+/,"");
248+
var templatePromise = $q(function(resolve) {
249+
if (angular.isString(element)) {
250+
$templateRequest(element).then(function (requestedTemplate) {
251+
resolve(angular.element(requestedTemplate).wrap('&lt;div>').parent());
252+
}, function(message) {
253+
throw "info-window template request failed: " + message;
254+
});
255+
}
256+
else {
257+
resolve(element);
258+
}
259+
}).then(function(resolvedTemplate) {
260+
var template = resolvedTemplate.html().trim();
261+
if (angular.element(template).length != 1) {
262+
throw "info-window working as a template must have a container";
263+
}
264+
infoWindow.__template = template.replace(/\s?ng-non-bindable[='"]+/,"");
265+
});
253266
infoWindow.__open = function(map, scope, anchor) {
254-
$timeout(function() {
255-
anchor && (scope.anchor = anchor);
256-
var el = $compile(infoWindow.__template)(scope);
257-
infoWindow.setContent(el[0]);
258-
scope.$apply();
259-
if (anchor && anchor.getPosition) {
260-
infoWindow.open(map, anchor);
261-
} else if (anchor && anchor instanceof google.maps.LatLng) {
262-
infoWindow.open(map);
263-
infoWindow.setPosition(anchor);
264-
} else {
265-
infoWindow.open(map);
266-
}
267-
var infoWindowContainerEl = infoWindow.content.parentElement.parentElement.parentElement;
268-
infoWindowContainerEl.className = "ng-map-info-window";
267+
templatePromise.then(function() {
268+
$timeout(function() {
269+
anchor && (scope.anchor = anchor);
270+
var el = $compile(infoWindow.__template)(scope);
271+
infoWindow.setContent(el[0]);
272+
scope.$apply();
273+
if (anchor && anchor.getPosition) {
274+
infoWindow.open(map, anchor);
275+
} else if (anchor && anchor instanceof google.maps.LatLng) {
276+
infoWindow.open(map);
277+
infoWindow.setPosition(anchor);
278+
} else {
279+
infoWindow.open(map);
280+
}
281+
var infoWindowContainerEl = infoWindow.content.parentElement.parentElement.parentElement;
282+
infoWindowContainerEl.className = "ng-map-info-window";
283+
});
269284
});
270285
};
271286
return infoWindow;
@@ -277,11 +292,11 @@ <h1 class="title">
277292
var filtered = parser.filter(attrs);
278293
var options = parser.getOptions(filtered, {scope: scope});
279294
var events = parser.getEvents(scope, filtered);
295+
var infoWindow = getInfoWindow(options, events, options.template || element);
280296
var address;
281297
if (options.position && !(options.position instanceof google.maps.LatLng)) {
282298
address = options.position;
283299
}
284-
var infoWindow = getInfoWindow(options, events, element);
285300
if (address) {
286301
NgMap.getGeoLocation(address).then(function(latlng) {
287302
infoWindow.setPosition(latlng);
@@ -292,7 +307,7 @@ <h1 class="title">
292307
}
293308
mapController.addObject('infoWindows', infoWindow);
294309
mapController.observeAttrSetObj(orgAttrs, attrs, infoWindow);
295-
mapController.showInfoWindow =
310+
mapController.showInfoWindow =
296311
mapController.map.showInfoWindow = mapController.showInfoWindow ||
297312
function(p1, p2, p3) { //event, id, marker
298313
var id = typeof p1 == 'string' ? p1 : p2;
@@ -332,7 +347,8 @@ <h1 class="title">
332347
//TODO DEPRECATED
333348
scope.showInfoWindow = mapController.map.showInfoWindow;
334349
scope.hideInfoWindow = mapController.map.hideInfoWindow;
335-
NgMap.getMap().then(function(map) {
350+
var map = infoWindow.mapId ? {id:infoWindow.mapId} : 0;
351+
NgMap.getMap(map).then(function(map) {
336352
infoWindow.visible && infoWindow.__open(map, scope);
337353
if (infoWindow.visibleOnMarker) {
338354
var markerId = infoWindow.visibleOnMarker;
@@ -347,7 +363,7 @@ <h1 class="title">
347363
};
348364
}; // infoWindow
349365
infoWindow.$inject =
350-
['Attr2MapOptions', '$compile', '$timeout', '$parse', 'NgMap'];
366+
['Attr2MapOptions', '$compile', '$q', '$templateRequest', '$timeout', '$parse', 'NgMap'];
351367
angular.module('ngMap').directive('infoWindow', infoWindow);
352368
})();
353369
</code></pre>

build/docs/source/map-lazy-load.html

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -209,17 +209,24 @@ <h1 class="title">
209209
/* global window, document */
210210
(function() {
211211
'use strict';
212-
var $timeout, $compile, src, savedHtml;
212+
var $timeout, $compile, src, savedHtml = [], elements = [];
213213
var preLinkFunc = function(scope, element, attrs) {
214214
var mapsUrl = attrs.mapLazyLoadParams || attrs.mapLazyLoad;
215-
window.lazyLoadCallback = function() {
216-
console.log('Google maps script loaded:', mapsUrl);
217-
$timeout(function() { /* give some time to load */
218-
element.html(savedHtml);
219-
$compile(element.contents())(scope);
220-
}, 100);
221-
};
222215
if(window.google === undefined || window.google.maps === undefined) {
216+
elements.push({
217+
scope: scope,
218+
element: element,
219+
savedHtml: savedHtml[elements.length],
220+
});
221+
window.lazyLoadCallback = function() {
222+
console.log('Google maps script loaded:', mapsUrl);
223+
$timeout(function() { /* give some time to load */
224+
elements.forEach(function(elm) {
225+
elm.element.html(elm.savedHtml);
226+
$compile(elm.element.contents())(elm.scope);
227+
});
228+
}, 100);
229+
};
223230
var scriptEl = document.createElement('script');
224231
console.log('Prelinking script loaded,' + src);
225232
scriptEl.src = mapsUrl +
@@ -235,7 +242,7 @@ <h1 class="title">
235242
};
236243
var compileFunc = function(tElement, tAttrs) {
237244
(!tAttrs.mapLazyLoad) && console.error('requires src with map-lazy-load');
238-
savedHtml = tElement.html();
245+
savedHtml.push(tElement.html());
239246
src = tAttrs.mapLazyLoad;
240247
/**
241248
* if already loaded, stop processing it

build/docs/source/places-auto-complete.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ <h1 class="title">
186186
* @example
187187
* Example:
188188
* &lt;script src="https://maps.googleapis.com/maps/api/js?libraries=places">&lt;/script>
189-
* &lt;input places-auto-complete types="['geocode']" on-place-changed="myCallback(place)" />
189+
* &lt;input places-auto-complete types="['geocode']" on-place-changed="myCallback(place)" component-restrictions="{country:'au'}"/>
190190
*/
191191
/* global google */
192192
(function() {
@@ -217,6 +217,11 @@ <h1 class="title">
217217
autocomplete.setTypes(optionValue);
218218
}
219219
});
220+
attrs.$observe('componentRestrictions', function (val) {
221+
if (val) {
222+
autocomplete.setComponentRestrictions(scope.$eval(val));
223+
}
224+
});
220225
};
221226
return {
222227
restrict: 'A',

0 commit comments

Comments
 (0)