Angular-google-maps: could not find a valid center property?

I am trying to work with angular -google-maps. I have all the settings as instructed, but I cannot get around this error:

angular -google-maps: could not find a valid center property

I have this in the page controller:

angular.extend($scope, {
   center: {
    latitude: 0, // initial map center latitude
    longitude: 0, // initial map center longitude
   },
   markers: [], // an array of markers,
   zoom: 8, // the zoom level
});

And this is in my html

<google-map center="center" zoom="zoom" markers="markers" refresh="!isMapElementHidden" style="height: 400px"></google-map>

A few points: - It seems that the angular -google-maps directive code is called before my controller code, so the $ scope.center variable has not yet been created

  • When I hard code the center in it,

  • I try this, but no luck, since the map never updates the new cope values ​​set in the controller:

    center = "center? center: {latitude: 36.990282103105066, longitude: -122.06149578094482}"

  • I also tried to implement Angular Leaflet cards and get the same issue

!

+4
2

, , r1-dev, master angular -google-maps, ,

 angular.extend($scope, {
        centerProperty: {
            lat: 45,
            lng: -73
        },
        zoomProperty: 8,
        markersProperty: [ {
                latitude: 45,
                longitude: -74
            }],
        clickedLatitudeProperty: null,  
        clickedLongitudeProperty: null,
    });

position: {
  coords: {
    latitude: 36.990282103105066,
    longitude: -122.06149578094482
  }
},
+5

, angular -google-, , lat lng, .

: 2.0.7 uiGmapgoogle, map - ui-gmap-google

0

All Articles