【发布时间】:2017-01-02 08:46:26
【问题描述】:
在我的项目中,我集成了谷歌地图。我有一个问题:当我搜索特定位置时,标记未显示在当前点,它显示在其他地方。但是,纬度和经度是正确的,你能帮我理解我错过了什么吗?
注意:对于某些位置,标记会显示在正确的位置。
HTML代码:
<input ng-model="address" class="form-control" ng-map-autocomplete/>
<ng-map zoom="18" center="{{address}}" style="width:650px; height:450px">
<marker position="{{address}}" title="{{address}}" draggable="true"></marker>
</ng-map>
控制器:
$scope.$watch(function ($scope) { return $scope.chosenPlaceDetails }, function () {
if (angular.isDefined($scope.chosenPlaceDetails )) {
$scope.latitude= $scope.chosenPlaceDetails.geometry.location.lat();
$scope.longitude=$scope.chosenPlaceDetails.geometry.location.lng();
}
});
【问题讨论】:
标签: javascript angularjs google-maps google-maps-api-3