<tfoot id='kujB8'></tfoot>

    1. <i id='kujB8'><tr id='kujB8'><dt id='kujB8'><q id='kujB8'><span id='kujB8'><b id='kujB8'><form id='kujB8'><ins id='kujB8'></ins><ul id='kujB8'></ul><sub id='kujB8'></sub></form><legend id='kujB8'></legend><bdo id='kujB8'><pre id='kujB8'><center id='kujB8'></center></pre></bdo></b><th id='kujB8'></th></span></q></dt></tr></i><div id='kujB8'><tfoot id='kujB8'></tfoot><dl id='kujB8'><fieldset id='kujB8'></fieldset></dl></div>
    2. <small id='kujB8'></small><noframes id='kujB8'>

      • <bdo id='kujB8'></bdo><ul id='kujB8'></ul>
    3. <legend id='kujB8'><style id='kujB8'><dir id='kujB8'><q id='kujB8'></q></dir></style></legend>

      基于 Leaflet 和 AngularJS 的地图未正确加载

      时间:2023-08-08

          1. <i id='9qqaj'><tr id='9qqaj'><dt id='9qqaj'><q id='9qqaj'><span id='9qqaj'><b id='9qqaj'><form id='9qqaj'><ins id='9qqaj'></ins><ul id='9qqaj'></ul><sub id='9qqaj'></sub></form><legend id='9qqaj'></legend><bdo id='9qqaj'><pre id='9qqaj'><center id='9qqaj'></center></pre></bdo></b><th id='9qqaj'></th></span></q></dt></tr></i><div id='9qqaj'><tfoot id='9qqaj'></tfoot><dl id='9qqaj'><fieldset id='9qqaj'></fieldset></dl></div>

            <small id='9qqaj'></small><noframes id='9qqaj'>

              <tbody id='9qqaj'></tbody>
            • <legend id='9qqaj'><style id='9qqaj'><dir id='9qqaj'><q id='9qqaj'></q></dir></style></legend>

              <tfoot id='9qqaj'></tfoot>
                <bdo id='9qqaj'></bdo><ul id='9qqaj'></ul>

                本文介绍了基于 Leaflet 和 AngularJS 的地图未正确加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我的基于 Leaflet 和 AngularJS 的地图没有正确加载.我不知道发生了什么,但地图图块没有按应有的方式布置.

                My map based on Leaflet and AngularJS is not loading correctly. I do not know what's going on but the maps tiles are not laid out as they should be.

                这是底图:

                这是我的代码:

                    function setMapPosition(){
                        $scope.center = {
                            lat: 51.505,
                                lng: -0.09,
                                zoom: 8
                        };
                
                
                        $scope.defaults= {
                            scrollWheelZoom: false
                        };
                
                        $scope.tiles = 'openstreetmap';
                    }
                

                推荐答案

                这个问题通常是由于在地图已经初始化时调整了任何父容器的大小.

                This problem often occurs due to resizing of any parent container while the map is already initialized.

                为了告诉地图有调整大小,您可以调用 map.invalidateSize();.

                In order to tell the map that there was a resize you can call map.invalidateSize();.

                也可能是您没有手动调整任何父容器的大小,那么可能的解决方案是在文档准备好后调用 map.invalidateSize();.

                It could also be that you didn't resize any parent container manually, then a possible solution would be to call map.invalidateSize(); after your document is ready.

                要使用 angular-leaflet-directive 执行此操作,请在控制器中尝试以下操作注入 leafletData.:

                To do this with the angular-leaflet-directive try the following inside your controller which injects leafletData.:

                leafletData.getMap().then(function(map) {
                    map.invalidateSize(false);
                });
                

                这篇关于基于 Leaflet 和 AngularJS 的地图未正确加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:传单 panTo(或 setview)功能? 下一篇:带有 R 中 addCircleMarkers 的传单地图的传说中的圆

                相关文章

                最新文章

                1. <small id='r3Jo4'></small><noframes id='r3Jo4'>

                2. <legend id='r3Jo4'><style id='r3Jo4'><dir id='r3Jo4'><q id='r3Jo4'></q></dir></style></legend>

                  1. <i id='r3Jo4'><tr id='r3Jo4'><dt id='r3Jo4'><q id='r3Jo4'><span id='r3Jo4'><b id='r3Jo4'><form id='r3Jo4'><ins id='r3Jo4'></ins><ul id='r3Jo4'></ul><sub id='r3Jo4'></sub></form><legend id='r3Jo4'></legend><bdo id='r3Jo4'><pre id='r3Jo4'><center id='r3Jo4'></center></pre></bdo></b><th id='r3Jo4'></th></span></q></dt></tr></i><div id='r3Jo4'><tfoot id='r3Jo4'></tfoot><dl id='r3Jo4'><fieldset id='r3Jo4'></fieldset></dl></div>
                      <bdo id='r3Jo4'></bdo><ul id='r3Jo4'></ul>
                    <tfoot id='r3Jo4'></tfoot>