feat(GoogleMap): Expose map for use with other apis
See original GitHub issueFeature Description
I have a map loaded on my screen, but I also want to use the Places Api. Although geocoding is supported by the library, places is not.
The map, and map instance, are created solely through my template
        <google-map [options]="options" class="col-sm-8">
            <map-marker
                [options]="markerOptions"
                [position]="markerPosition"
            ></map-marker>
        </google-map>
I have been trying the following code
        const map1: any = document.querySelector("google-map") as unknown;
        console.log("lookup", map1)
        const map2: GoogleMap = map1;
        var request = {
            query: 'albina',
            fields: ['name', 'geometry'],
        };
        var service = new google.maps.places.PlacesService(map2);
        service.findPlaceFromQuery(request, (results, status) => console.log(results, status))
This works in javascript - the querySelector returns the dom node, but it can be passed successfully to PlacesService. As I am using typescript I keep being told that I can’t pass an html element (not withstanding my attempts to override the type).
Really what I want is to access the map as is, rather than using dom lookups, but I cannot work out how to access that. As you can see, I am able to create and pass options to the component, but don’t know angular well enough to get the map back
Use Case
I also want to use the Places Api which requires me to pass a google map. the obvious candidate is the one created by this component, but I cannot see how to access it
Issue Analytics
- State:
 - Created a year ago
 - Comments:5 (3 by maintainers)
 

Top Related StackOverflow Question
Something like this:
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.