InvalidValueError when upgrading from beta.3 to beta.5
See original GitHub issueIssue description Upgrading from 1.0.0-beta.3 to 1.0.0-beta.5 causes the following error in Chrome:
ERROR Error: Uncaught (in promise): InvalidValueError: not a LatLngBounds or LatLngBoundsLiteral: not an Object Error
This only happens on maps that I am using the following function on. Any other maps with a single marker do not cause the error.
this.mapsAPILoader.load().then(() => {
this.latlngBounds = new window['google'].maps.LatLngBounds();
for (const point of this.points) {
this.latlngBounds.extend(new window['google'].maps.LatLng(point['lat'], point['lng']));
}
});
After diving into it a little more, it is the [fitBounds]
input on the agm-map
tag that is causing the error. Has the format of how we are supposed to pass the data object into [fitBounds]
changed?
<agm-map [latitude]=""
[longitude]=""
[zoom]=""
[fitBounds]="latlngBounds"> <!-- passing it into fitBounds is what is causing the error -->
Steps to reproduce and a minimal demo of the problem
Here is a stackblitz, that shows the error. Changing the agm/core dependency to beta.3 will fix the error. https://stackblitz.com/edit/angular-google-maps-demo-fjugvd?file=app%2Fapp.module.ts
What steps should we try in your demo to see the problem?
- Fork the repo
- Run the code and open a console to see the error.
- In package.json, chagne agm/core to beta.3
- Save, and make sure the dependencies dropdown is beta.3
- Run the code and open a console to see no error
Current behavior Error being thrown when upgrading when previous version did not throw the error. Or an explanation of a proper way to upgrade.
Expected/desired behavior No errors should be caused by the upgrade.
angular2 & angular-google-maps version 1.0.0-beta.3 works 1.0.0-beta.4 errors 1.0.0-beta.5 errors
Other information
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:5
Top GitHub Comments
with setting the initial value to false worked for me. this.latlngBounds : any = false;
try this it worked for me: <agm-map [fitBounds]=“true”> <agm-marker [agmFitBounds}=“true” …