0

I am using ng-map directive as below:

var center1 = $scope.latitude;
var center2 = $scope.longitude;
console.log(typeof center1);
$scope.map_center = [center1, center2];
<div>
  <map ng-transclude class="google-map" center="map_center" options="map.options">
    <points coords="points.coords" options="points.options" events="points.events" decimals="points.decimals"></points>
  </map>
</div>

This renders the map view as blank. However on hardcoding the center it works fine. Im confused what is the issue.

empiric
  • 7,825
  • 7
  • 37
  • 48
Vikas J
  • 358
  • 1
  • 5
  • 17

2 Answers2

0

If the problem is that the map is not rendered (blank page), you might have it into a containder with dimensions 0, and you must redimensionate in css. This is a common issue when you use google maps for angularjs, maybe here the problem is the same.

Wakachopo
  • 149
  • 7
0

Your JS be like this, No need to use var scope is enough. If you want you may use, but it takes few more lines of code thats it...

$scope.map_center=[$scope.latitude,$scope.longitude];  

and Should use map_center inside {{}} , because some function in angular will work inside paranthesis ..

so your HTML should be,

center="{{map_center}}" 

this will work for sure..

Mohideen bin Mohammed
  • 18,813
  • 10
  • 112
  • 118