-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug([google-map]): [README.MD example only produces grey rectangle, no map] #18965
bug([google-map]): [README.MD example only produces grey rectangle, no map] #18965
Comments
Try installing @angular/google-maps@9.1.3 |
In 2a6aae1 I added the ability to set the `mapTypeId` and after I was done with it and ran the unit tests, I added a default of `undefined` to the `DEFAULT_OPTIONS` so the tests didn't have to be updated. It looks like having the `undefined` in the defaults causes Google Maps not to render anything in the map until the map type changes. These changes remove the default value and update the tests instead. Fixes angular#18965.
Works ! Thanks |
Worked for me too. 9.2.0 seems broken. |
In 2a6aae1 I added the ability to set the `mapTypeId` and after I was done with it and ran the unit tests, I added a default of `undefined` to the `DEFAULT_OPTIONS` so the tests didn't have to be updated. It looks like having the `undefined` in the defaults causes Google Maps not to render anything in the map until the map type changes. These changes remove the default value and update the tests instead. Fixes #18965.
In 2a6aae1 I added the ability to set the `mapTypeId` and after I was done with it and ran the unit tests, I added a default of `undefined` to the `DEFAULT_OPTIONS` so the tests didn't have to be updated. It looks like having the `undefined` in the defaults causes Google Maps not to render anything in the map until the map type changes. These changes remove the default value and update the tests instead. Fixes #18965.
I still see the issue, even after having installed v9.1.3.
I've tried: -Setting different css |
The fix that closed this issue hasn't been released yet. |
In 2a6aae1 I added the ability to set the `mapTypeId` and after I was done with it and ran the unit tests, I added a default of `undefined` to the `DEFAULT_OPTIONS` so the tests didn't have to be updated. It looks like having the `undefined` in the defaults causes Google Maps not to render anything in the map until the map type changes. These changes remove the default value and update the tests instead. Fixes #18965.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Reproduction
The README for Google Maps contains code that produces just a grey map:
https://github.com/angular/components/blob/master/src/google-maps/README.md
Steps to reproduce:
Add the readme code to a brand new simple new demo project (ng new demo)
Expected Behavior
The map should be displayed correctly, without having to force a refresh.
Actual Behavior
A grey rectangle is displayed where the map should be.
No error messages are produced.
Note the README example did work correctly for Google Maps in Angular Components 9.0.
With Google-Maps in Angular Components 9.2, to get a map correctly displayed, one now needs to add this extra line to the demo .html file:
[mapTypeId]="mapTypeId"
And add this line to the demo .ts file:
mapTypeId: google.maps.MapTypeId;
and also implement AfterViewInit to force a redraw:
export class GoogleMapDemo implements AfterViewInit {
..
ngAfterViewInit(): void {
// Vary the map properties somehow to force a redraw
this.mapTypeId = google.maps.MapTypeId.ROADMAP;
}
}
Environment
The text was updated successfully, but these errors were encountered: