-
Notifications
You must be signed in to change notification settings - Fork 131
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
ngx-Mapbox-gl only displaying in half the container #98
Comments
Hey @p-craig-peddie
seemed to work for me, only a workaround though. However could be an issue when trying to do the same with an external css over mgl-map |
I know this can be a little late but when I faced the same problem, I did a little bit of reading and research to find out that the map when displayed through bootstrap Modal, angular, etc. shows default 400px width and will not take the previous container's width as it is not aware of it and hence its a good practice to use map.resize() method inside the map.on('load',function(){}) in the end of it. |
Thanks, fixed it by listening to load event and calling component.html
component.ts
|
I have the same problem. I tried to use your <mgl-map (load)="onMapLoad($event)"> and then onMapLoad(map) { but my console says: Cannot read property 'resize' of undefined. |
@ZdenekPoznerJr That's because you are resizing 'this.map' (which is probably not initialized by that moment). Use parameter 'map' instead: map.resize(); |
work great |
Event handler should be:
|
I'm trying to get ngx-mapbox-gl to display a map in an angular app, but the map is only displaying in half the div. Have played with multiple settings and html tweaks, but cannot get more than half a map to display. Here is the map.component.html file:
`
`
and the map.component.scss:
`
@import 'mapbox-gl/dist/mapbox-gl.css';
`
map.component.ts:
`
}`
app.module.ts:
`
`
Here's a screenshot of what I'm seeing:
If I remove the map,the border of the div it taking the entire window as it should. But I can't get the map to use up the entire window. Is it css or html or ts I'm doing wrong?
Thanks....
The text was updated successfully, but these errors were encountered: