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.

Reference error when using fitBounds with LatLngBoundsLiteral

See original GitHub issue

Issue description Map component is not waiting for lazy loaded google API to be ready when using LatLngBoundsLiteral in fitBounds input

Steps to reproduce and a minimal demo of the problem

  • Create a simple map with a LatLngBoundsLiteral in the fitBounds input

https://stackblitz.com/edit/angular-google-maps-demo-yuwcde?file=app%2Fapp.component.html

Current behavior Since the google maps API has not loaded yet during the OnChanges hook you can see an exception within the above example: Reference error “google” is not defined

Expected/desired behavior The map component should inject the api loader and use the load() method to obtain the Promise which resolves when the API is ready. By waiting for that promise to resolve and deferring the call to the API to fit the bounds, the issue should be fixed.

angular2 & angular-google-maps version Angular 6.1.7 / agm 1.0.0-beta.5

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:6

github_iconTop GitHub Comments

1reaction
fredgatecommented, May 28, 2019

A new release of the library should be published on NPM to have fix of this bug. How to do ? This project seems to die slowly.

0reactions
stale[bot]commented, May 27, 2019

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

Reference error when using fitBounds with LatLngBoundsLiteral
Issue description. Map component is not waiting for lazy loaded google API to be ready when using LatLngBoundsLiteral in fitBounds input.
Read more >
Error when trying to create a LatLngBounds object from valid ...
Looks like you're passing an object to the constructor instead of 2 parameters - have you tried this: var bounds = new google.maps....
Read more >
Google Maps JavaScript API V3 Reference
This is an index of all the classes, methods, and interfaces in the Maps JavaScript API version 3.51 (weekly channel). This reference is...
Read more >
L.LatLngBounds - WRLD3D
Returns true if the rectangle is equivalent (within a small margin of error) to the given bounds. isValid(), Boolean. Returns true if the...
Read more >
Angular Google Map Component Basics: Tips and Tricks
In this case, you can use the 'fitBounds' method from the google map component. It takes LatLngBoundsLiteral type which has north, south, ...
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