首页 > 解决方案 > 标记需要时间才能出现在地图中

问题描述

我正在尝试使用 ng-map 在我的地图中显示一个独特的标记,地图出现了,但我必须等待几秒钟才能看到标记。有人知道解决这个问题吗?

HTML:

<div class="row"  >
        
        <div class="col">
        <input type="button" class="button button-block main_btn" style="min-height: 33px;line-height:35px;" value="Ma position"  ng-click="getCurrentPosition()"/>
        </div>
      </div>
<div id="map">
      <ng-map  map-lazy-load="https://maps.googleapis.com/maps/api/js?key=AIzaSyDtNrxHdNkqg3pCuHNi65_TulAeHU44d4Q&libraries=places" style="width:100%" 
      center="{{latLng.lat}},{{latLng.lng}}" zoom="{{zoom}}" >
        <marker position="{{latLng.lat}},{{latLng.lng}}" draggable="true" on-dragend="getCurrentLocation()"></marker>
      </ng-map>
</div>

JS

$scope.getCurrentPosition = function () {
            $fileLogger.info('function : getCurrentPosition ');
                $cordovaGeolocation.getCurrentPosition(options).then(function (position) {
                $ionicLoading.show({
                    template: 'Chargement...'
                });
                $scope.latLng.lat = position.coords.latitude;
                $scope.latLng.lng = position.coords.longitude;
                $scope.zoom = MAP.ZOOM_17;
                $ionicLoading.hide();
            }, function (error) {
                $ionicLoading.hide();
                $fileLogger.error(error.message);
            });
        }
       
        };

标签: javascriptionic-framework

解决方案


推荐阅读