2016-07-04 3 views
0

현재 Ionic 프레임 워크가있는 하이브리드 응용 프로그램을 개발 중입니다.이 문제를 만났습니다. 지도를 사용하여 좌표가 지정된 위치를 결정하고 싶습니다. 위도, 경도, 즉 으로 I는지도를 표시하는 데 성공하지만 고려 좌표 x와 y를 가지고 있지 않지만,지도 배위 (0.0) enter image description hereionic : 좌표 위도 경도에서지도를로드하는 방법

.controller("AddIncidentCtrl" , function($scope , currentService, $ionicModal , $http , $location,$rootScope,$ionicPopup,$cordovaGeolocation){ 



$scope.zone = { 

    latitude: "", 
    longitude: "", 
} 

var options = {timeout: 10000, enableHighAccuracy: true}; 


var latLng = new google.maps.LatLng($scope.zone.latitude, $scope.zone.longitude); 

var mapOptions = { 
    center: latLng, 
    zoom: 15, 
    mapTypeId: google.maps.MapTypeId.ROADMAP 
}; 

$scope.map = new google.maps.Map(document.getElementById("map"), mapOptions); 
google.maps.event.addListenerOnce($scope.map, 'idle', function() { 

    var marker = new google.maps.Marker({ 
    map: $scope.map, 
    animation: google.maps.Animation.DROP, 
    position: latLng 
    }); 

    var infoWindow = new google.maps.InfoWindow({ 
    content: "Here I am!" 
    }); 

    google.maps.event.addListener(marker, 'click', function() { 
    infoWindow.open($scope.map, marker); 
    }); 

}); 

의 값을 취 })

답변

0

$scope.markers.push(marker); 

을 템플릿 파일 :이처럼 각각의 마커를 추가 $ 범위 : 나는 그것을 넣어야 할 경우

<div id="class" ng-repeat="marker in markers | orderBy : 'title'"> 
     <a href="#" ng-click="openInfoWindow($event, marker)">{{marker.title}}</a> 
     </div> 
+0

내가 이해하지 못했지만, 여기 내 템플릿 파일

+1

일부 값 등이 추가됩니다. zone = { 위도 : "26.0977928", 경도 : "50.563882", } – CrazyVK56

관련 문제