Skip to content
This repository has been archived by the owner on May 11, 2020. It is now read-only.

Commit

Permalink
fixes issue #745, issue #749
Browse files Browse the repository at this point in the history
  • Loading branch information
allenhwkim committed Mar 8, 2017
1 parent 642e2b7 commit 0408fa4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions services/ng-map.js
Expand Up @@ -47,14 +47,17 @@
var getMap = function(id, options) {
options = options || {};
id = typeof id === 'object' ? id.id : id;
id = id || 0;

var deferred = $q.defer();
var timeout = options.timeout || 10000;

function waitForMap(timeElapsed){
if(mapControllers[id]){
var keys = Object.keys(mapControllers);
var theFirstController = mapControllers[keys[0]];
if(id && mapControllers[id]){
deferred.resolve(mapControllers[id].map);
} else if (!id && theFirstController && theFirstController.map) {
deferred.resolve(theFirstController.map);
} else if (timeElapsed > timeout) {
deferred.reject('could not find map');
} else {
Expand Down
2 changes: 1 addition & 1 deletion testapp/directions.html
Expand Up @@ -45,7 +45,7 @@
<option value="TRANSIT">Transit</option>
</select>

<ng-map zoom="14" center="37.7699298, -122.4469157" style="height:90%" on-click="logLatLng()" >
<ng-map zoom="14" id="my-map" center="37.7699298, -122.4469157" style="height:90%" on-click="logLatLng()" >
<directions
draggable="true"
panel="directions-panel"
Expand Down

0 comments on commit 0408fa4

Please sign in to comment.