我使用NG-地图在Angular.js出于某种原因,我的地图画面变灰整个地图的90%,像这样:NG-地图显示HTML部分地图
我的HTML是很简单:
<div id="map">
<map></map>
</div>
我甚至尝试添加CSS像这样:
<style>
#map{
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
</style>
这里是我的控制器:
$scope.$on('mapInitialized', function(event, map) {
$scope.map.setCenter(new google.maps.LatLng($scope.location.latitude, $scope.location.longitude));
$scope.setZoom(4);
}
我已经添加了使用ngMap的脚本。如果这可能会导致问题,我也删除了任何AdBlock。
编辑:google.maps.event.trigger(map,'resize');作品
可能重复的[如何做:我通过设定图的容器的宽度和高度为100%,加入一个id到NG-地图在html和通过将下一个代码进入状态的控制器固定的问题我调整谷歌地图与JavaScript后加载?](http://stackoverflow.com/questions/743214/how-do-i-resize-a-google-map-with-javascript-after-it-has-加载) – laughingpine
确保贴图的父元素具有正确的尺寸。 – AndreaM16