angular-google-maps: GoogleMapsAPIWrapper getBounds not returning
Hello, I am trying to get the maps bounds thourgh the GoogleMapsAPIWrapper service. I am using the Promise<LatLngBounds> function getBounds().
Nothing is returned.
Here’s my code.
constructor(private searchService: SearchService,
private wrapper: GoogleMapsAPIWrapper,
private _loader: MapsAPILoader,
private zone: NgZone) {
}
ngOnInit() {
this.wrapper.getBounds().then(x => console.log(x));
}
the console.log function is not called as the peomise never returns anything.
Thanks
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 5
- Comments: 21 (1 by maintainers)
@SebastianM Im using Angular4, I can confirm GoogleMapsAPIWrapper’s promises don’t work.
Using
sebm-google-map
component inside a template you can use:and then inside your component:
thanks to @jplew in this way can get Bounds 😉
Even calling “getNativeMap” and doing “then” on that isn’t getting called at all.
I experienced the same issue when trying to do it on a component that had
<sebm-google-maps>
in the template. My workaround was to create a custom component to drop inside<sebm-googe-maps><custom-component></custom-component></sebm-google-maps>
to perform the needed functionality.