error showing Google Maps API map inside ng-show AngularJS

0

It turns out that when showing the map there is normally no problem, but if I have it in a ng-show and I show it when changing the condition, the area of the map is shown in a "grayish" tone without being able to see anything. I have noticed that when you maximize the screen or change the size of the window where the map is located, it is shown again. the code is very simple.

Controller:

$scope.mostrar = false;
$scope.cambio = function(){
  $scope.mostrar = !$scope.mostrar;
}

$scope.mapBasico = {
        center: { latitude: 40.4167, longitude: -3.7035},
        zoom: 6,
        markers: [],
        control: {},
        events: {

        }
};

View:

<button ng-click="cambio()">Mostrar u Ocultar Mapa</button>
<div ng-show="mostrar">
    <ui-gmap-google-map  control="mapBasic.control" center="mapBasic.center" zoom="mapBasic.zoom" id="mapBasic">
    <ui-gmap-marker ng-repeat="m in mapBasic.markers" coords="m.coords" icon="m.icon" options = "m.options" idkey="m.id"></ui-gmap-marker>   
    </ui-gmap-google-map >
</div>
    
asked by Javi 26.09.2017 в 10:31
source

0 answers