question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Access to full google.maps object

See original GitHub issue

Hi, loving your work so far, but am curious, will this library ever grant access to the full google.maps object, similar to angular1’s implementation of google-maps? (see here: http://angular-ui.github.io/angular-google-maps/#!/api/GoogleMapApi)

Getting the google.maps object lets you create, for example…

A1 code to create new DirectionsRenderer and DirectionsService:

            uiGmapGoogleMapApi.then(function(maps) {
                vm.gmaps = maps;
                vm.map.directionsDisplay = new vm.gmaps.DirectionsRenderer();
                vm.map.directionsService = new vm.gmaps.DirectionsService();
            });

Or to create a new LatLng object:

var latlng = new vm.gmaps.LatLng(lat, lng);

Is this going to be possible with this library?

EDIT: I do see that the google object is available globally… so we can do var latlng = new google.maps.LatLng(lat,lng); However, isn’t it one goals of the project to prevent the google object from polluting the global namespace?

EDIT to EDIT: Also see now we can use LatLngLiteral interface, so that deals with one problem:

import {LatLngLiteral} from 'angular2-google-maps/core';

...

var latlng = <LatLngLiteral>{lat: this.latitude, lng: this.longitude};
this.map.setCenter(latlng);

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

9reactions
cthraxcommented, Mar 23, 2016

If I’m understanding everything here correctly, wouldn’t the most angular way of handling this be to have a service that returns the global object? This would enable mocking for testing and avoid global dependencies.

0reactions
stale[bot]commented, Nov 14, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Access to full google.maps object · Issue #209 - GitHub
Hi, loving your work so far, but am curious, will this library ever grant access to the full google.maps object, similar to angular1's ......
Read more >
Maps JavaScript API | Google Developers
An instance of Data , bound to the map. Add features to this Data object to conveniently display them on this map. mapTypes....
Read more >
How to access google.maps.Map object with react-google-maps
You can do it by React refs: <GoogleMap ref={(map) => this._map = map} /> function someFunc () { //using, for example as: this._map....
Read more >
Google Maps API - Core Objects - ProTech Training
Google Maps API - Core Objects. ... Typically, we'd assign the map to a <div> element so that later we can access if...
Read more >
Adding Google Maps to a Flutter app - Google Codelabs
The plugin automatically handles access to the Google Maps servers, ... These objects provide additional information for map locations, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found