1

I am taking NorthEast coordinates with the following code. But how can I show this lat0 coordinate in the marker function. Can you help me?

google.maps.event.addListener($scope.map, 'idle', function(event){
			var lat0 = $scope.map.getBounds().getNorthEast().lat();
			var lng0 = $scope.map.getBounds().getNorthEast().lng();
			var lat1 = $scope.map.getBounds().getSouthWest().lat();
			var lng1 = $scope.map.getBounds().getSouthWest().lng();
			});
			

this is working well but how to show lat0 in marker funtion

var createMarker = function (info) {
	
        var marker = new google.maps.Marker({
            map: $scope.map,
            position: new google.maps.LatLng(info.lat, info.lng),
            title: info.prop_Name,
			animation: google.maps.Animation.DROP,
			lat0 : **lat0** ?? notworking ??
        });
  }

note: info.lat0 not working

5
  • What are you trying to make exactly? 'Cause a marker is defined by a lat and a lng and you have it in the marker object. Commented Jan 19, 2017 at 8:23
  • I want to show lat0 in the div. For example {{marker.lat0}} Commented Jan 19, 2017 at 8:35
  • my full code jsfiddle.net/vipul_me/Lsvqygff/6 Commented Jan 19, 2017 at 8:37
  • i want show lat0 in <div ng-app="hotelApp" ng-controller="ContentControler"> {{marker.lat0}} </div> Commented Jan 19, 2017 at 8:56
  • See my answer and this plkr: jsfiddle.net/x2nt8onf/1 Commented Jan 19, 2017 at 10:15

1 Answer 1

2

The variables are not updated with the digest cycle.

Use apply on your scope and it works great.

google.maps.event.addListener($scope.map, 'idle', function
    $scope.test = $scope.map.getBounds().getNorthEast().lat();
    $scope.$apply();
});

Template:

Lat0: {{test}}

I just made tests, I let you use it as you want with your markers.

Sign up to request clarification or add additional context in comments.

3 Comments

Hi, it will be a responsibility. You can write me the price of the search result page of airbnb site.
HI @MehmetGenç what do you mean?
Could you write me the airbnb.com search result page? How much is the fee? airbnb.com.tr/s/… php+mysql+angular

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.