GuillaumeLeclerc / vue-google-maps

Google maps component for vue with 2-way data binding
561 stars 655 forks source link

`loaded` promise resolves without map instance #101

Closed PandaWhisperer closed 8 years ago

PandaWhisperer commented 8 years ago

Synopsis

The loaded promise does not resolve with the map instance, as described here. Instead, it resolves to undefined (see manager.js#L10-L12).

Background

I am trying to implement Place Search, which requires instantiating google.maps.places.PlacesService, which needs an instance of the map object. I currently can't seem to find another way to get a hold of it (other than the loaded promise).

PandaWhisperer commented 8 years ago

Update: I was able to achieve what I wanted by using the Map component's mapCreated promise.

Additionally, it turns out that the mapObject is also exposed on the component.

Anyhow, the documentation for the loaded promise is still incorrect, as mentioned in the original issue.

GuillaumeLeclerc commented 8 years ago

Indeed you are right and it is impossible to resolve it to a map since there might not be a map (you could load the library without instantiating a single map, just to use the autocomplete form). Or you could have multiple maps on the page. Therefore the doc is wrong, I will update that now.

GuillaumeLeclerc commented 8 years ago

Actually it was a typo in the code, the text description is absolutely correct