隐藏div中的angular-google-map

时间:2015-04-18 06:31:16

标签: javascript angularjs angular-google-maps

最初有角度的谷歌地图是在隐藏的div中定义的。当我点击按钮时,地图只显示在div的左上方(地图的1/4)。我正在使用此代码 -

<div id="angular-google-map-container" class="col-sm-12 view-padding">
   <ui-gmap-google-map center="mapView.center" zoom="mapView.zoom" draggable="true" dragging="mapView.dragging">
        <ui-gmap-markers models="places | studiofilter : multipleDemo.activity : multipleDemo.location : multipleDemo.studio" coords="'coords'" events="cityMarkerEvents">
             <ui-gmap-windows show="'places.show'" >
                   <div > Map</div>                
             </ui-gmap-windows>
         </ui-gmap-markers>

这个问题已经在stackoverflow中被提出但是所有都与谷歌地图api有关。我如何解决这个问题

1 个答案:

答案 0 :(得分:0)

app.controller('gMapCtrl', ['$scope','uiGmapIsReady', function($scope, IsReady){
$scope.map = { center: { latitude: 45, longitude: -73 }, zoom: 8 };
$scope.displayed = false;
$scope.showMap = function(){
    $scope.displayed = true;
    IsReady.promise().then(function (maps) {
        google.maps.event.trigger(maps[0].map, 'resize');
    });
}
}]);