angular-google-maps icon indicating copy to clipboard operation
angular-google-maps copied to clipboard

dynamic Longitude and altitude google may

Open estem opened this issue 7 years ago • 0 comments

Hi guys, i want to show in google map the current altitude and logitude, when the init function execute it works good but when i tried to execute create marker function it doesnt work.

dashboard.init=function(){
         var mapOptions = {
                    zoom: 4,
                    center: new google.maps.LatLng(-25.5349952, 125.8554386),
                    mapTypeId: google.maps.MapTypeId.ROADMAP
                }


               $scope.map = new google.maps.Map(document.getElementById('map'), mapOptions);

               $scope.markers = [];
               $scope.cities = [];
      
        var infoWindow = new google.maps.InfoWindow();
 }
       
       
        dashboard.createMarker = function(latt,long) {
                alert(latt+'  '+long+'fggf');
          var marker = new google.maps.Marker({
              map: $scope.map,
              position: new google.maps.LatLng(latt, long),
              title: 'city.city'

          });
          marker.content = '<div class="infoWindowContent">' + 'city.desc' + '</div>';

          google.maps.event.addListener(marker, 'click', function() {
              infoWindow.setContent('<h2>' + marker.title + '</h2>' + marker.content);
              infoWindow.open($scope.map, marker);
          });
    
    $scope.markers.push(marker);
};

html

<div ng-init="dashboard.init()"  id="map"></div>

is there a way to make createmarker function that it have to update google map's altitude and longitude.

estem avatar Mar 06 '17 11:03 estem