Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 谷歌地图在可视化过程中出错_Javascript_Css_Angularjs_Google Maps_Pug - Fatal编程技术网

Javascript 谷歌地图在可视化过程中出错

Javascript 谷歌地图在可视化过程中出错,javascript,css,angularjs,google-maps,pug,Javascript,Css,Angularjs,Google Maps,Pug,我在Angular应用程序中有一个处理google map的小指令: app.directive('googleMaps', function($rootScope, $q, $window){ var mapLoader = $q.defer(); function loadGoogleApi(key){ var script = document.createElement('script'); script.type = 'text/javascri

我在Angular应用程序中有一个处理google map的小指令:

app.directive('googleMaps', function($rootScope, $q, $window){
   var mapLoader = $q.defer();
   function loadGoogleApi(key){
       var script = document.createElement('script');
       script.type = 'text/javascript';
       script.src= "https://maps.googleapis.com/maps/api/js?key=" + key + "&callback=initMap";
       $('body').append(script);
       return mapLoader.promise;
   };
   $window.initMap = function(){
       mapLoader.resolve();
   };
   return {
       restrinct: 'E',
       link: function($scope, element, attrs){
           loadGoogleApi('AIzaSyBtuQ-wYoHqnAxpXh8hTAfEH8BQCiBSCWw').then(function(){
               $scope.map = new google.maps.Map(element[0], {
                   zoom: 4,
                   center: { lat: 20, lng: 40 }
               });
               google.maps.event.trigger($scope.map,'resize');
           });

       }
   };
});
然后在我的index.jade中,我有以下代码:

//Other stuff
div.col.s12.m12.map-container
    h6="I miei spot"
    google-maps
所有的初始化过程都成功了,但是当我使用网站上的地图时,我可以看到各种奇怪的图形错误,比如

我在代码的这一部分使用materialize.css和这个简单的css:

google-maps { width: 100%; height: 300px;display: block; }
.map-container { height: 220px;margin-top: 10px; }

我不明白为什么会有这个bug,我在互联网上也没有找到任何关于这个bug的信息。

我通过在css文件中删除这行代码解决了这个问题:

.map-container img { border-radius: 50%; }
这是一个简单的逻辑错误