javascript - 标记需要时间才能出现在地图中
问题描述
我正在尝试使用 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);
});
}
};
解决方案
推荐阅读
- mysql - 如何使用 nativeQuery 和 Spring PagingAndSortingRepository 在 JPA 中分页查询
- sql-server - Unwanted square brackets inserted in SQL statement from ORM
- ruby - 添加祝贺信息 pong gosu
- linux-kernel - write_room Full - tty Driver
- bokeh - 在 Bokeh 中使用复选框时如何默认隐藏一行
- python - 远程python客户端无法访问couchbase服务器
- ios - Unable to decrypt string encrypted using openssl -aes256 in swift
- nhibernate - 使用 NHibernate “迁移”数据库
- php - 我是否打算为 Laravel 中的中间表创建模型?
- java - How to create simple Factory design pattern in Spring-boot?