Vincent Zhou
Vincent Zhou

Reputation: 503

Angular-google-map bounds example

failed to figure out how to do it. I have a bunch of markers and I manually calculated the northeast and southwest points. but it looks there is no effect; ( looking forward an example how to use the bounds. Thanks.

html:

<google-map center="map.center" zoom="map.zoom" pan="true" draggable="true" bounds="maps.bounds"> 

js:

$scope.map = {
        // http://angular-google-maps.org/use
        center: {
            latitude: 34.04858,
            longitude: -84.29431
        },
        zoom: 16,
        lineStyle: {
            color: '#333',
            weight: 5,
            opacity: 0.7
        },
        bounds:{}

    };    
// in another call...............
$scope.map.bounds={
                          northeast : northeast,
                          southwest: southwest
                        }
  $scope.$apply();

Upvotes: 8

Views: 1983

Answers (2)

moeabdol
moeabdol

Reputation: 5049

It might be the case that you need to apply this dynamically after map load. Try the following:

$scope.$apply(function() {
    $scope.map = { ... }
});

Upvotes: 0

hayatoShingu
hayatoShingu

Reputation: 419

I think that the problem may be the zoom. Logically speaking the zoom concept is not gets along with bounds, because the bounds define a zoom.

Upvotes: 1

Related Questions