google 地图灰色无效

google maps gray color not working

google 地图灰色不起作用它只有在我调整浏览器大小时才有效,我使用的是 AngularJS 1.6.4

html

<ng-map zoom="8" center="{{h.latitude}},{{h.longitude}}" class="col s12 m12" scale-control="true" map-type-control="true" map-type-control-options='{position:"top_right", style:"dropdown_menu", mapTypeIds:["HYBRID","ROADMAP","SATELLITE","TERRAIN"]}' id="map"
  style="height:auto;">
  <marker position="{{h.latitude}},{{h.longitude}}" icon="https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png">
  </marker>
</ng-map>

ini.js

//home feed
var app = angular.module('homephotos', ['ngMap']);
app.controller('home', function($scope, $http, $timeout, NgMap) {
  $http.get("http://xxx")
    .then(function(response) {
      $scope.home_feed = response.data.results;
    });

  //Init maps
  $scope.iniMap = function() {
    NgMap.getMap().then(function(map) {
      var center = map.getCenter();
      google.maps.event.trigger(map, 'resize');
      map.setCenter(center);
      console.log(map);
    });
  }
});

只需要在点击查看更多选项 inigeocode

时在每次关闭时调用一个例子 post
     $scope.init_geocode = function() {

         console.log('init_geocode');

        geocoder = new google.maps.Geocoder();
         latlng = new google.maps.LatLng(attrs.lat, attrs.lng);

           geocoder.geocode({ 'latLng': latlng }, function  (results, status) {

             if (status == google.maps.GeocoderStatus.OK) {
                 if (results[1]) {
                     var city = results[1].formatted_address;
                     element.text(city);
                 }
                 else {
                     element.text('Location not found');
                 }
             }
                else if (status == google.maps.GeocoderStatus.OVER_QUERY_LIMIT) {
                 setTimeout(function () {
                  $scope.init_geocode();
                  element.text('Geocoder failed due to: ' + status);
               }, 1000);

            }
               else {
                   element.text('Geocoder failed due to: ' + status);
               }

           });
        }