allenhwkim / angularjs-google-maps

The Simplest AngularJS Google Maps V3 Directive
http://ngmap.github.io
MIT License
1.52k stars 516 forks source link

NgMap.getMap( segmentId ) not working if id attr contains expression #873

Open tomcat86 opened 6 years ago

tomcat86 commented 6 years ago

My map is defined as: <ng-map id="{{box.id}}_map" center="{{box.center}}"></ng-map>

Ng.getMap( "4342342_map" ) can however not return this map, because in addMap the mapCtrl.map.id is undefined. I could debug so far, but I don't know how to fix this to be honest. I guess the expression is not being evaluated.

  var addMap = function(mapCtrl) {
    if (mapCtrl.map) {
      var len = Object.keys(mapControllers).length;
      mapControllers[mapCtrl.map.id || len] = mapCtrl;
    }
  };