내 프로젝트에서 Google지도를 통합했습니다. 한 가지 문제가 있습니다. 특정 위치를 검색 할 때 마커가 현재 위치에 표시되지 않고 다른 위치에 표시되고 있습니다. 그러나 위도와 경도가 정확합니다. 제가 누락 된 부분을 이해하도록 도와 줄 수 있습니까?Google지도 아이콘이 정확한 위치에 표시되지 않습니다.
참고 : 일부 위치의 경우 마커가 올바른 위치에 표시됩니다.
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();
}
});
어떻게 .. 다음 –
을 컨트롤러에 코드를 변경 한 달 무슨 짓을했는지 다시 시도, 어쩌면 넣어 세부 변수의 $ watchcher $ scope. $ watch ('details', function (newValue, oldValue) { $ scope.latitude = newValue.geometry.location.lat; $ scope.longitude = newValue.geometry 위치 .lng } }); ' – Roux
안녕하세요, 제 컨트롤러에서 Roux는 다음과 같은 초기 값을 부여했습니다 : \t $ scope.address = "12180 Park Ave S, Tacoma, WA 98447, USA"; \t $ scope.lat = "47.146427232895235"; \t $ scope.lng = "- 122.4420750597717"; –