2017-04-04 70 views
0
 for (let i of this.latlong) { 
      this.customWindow = '<div ng-click="mapSearchController.getRestaurantBranchPage(' + i.restaurantId + ')"><img width="150" height="150" src="client/' + i.restaurantImg + '"/>' + '<b>' + i.restaurantTagline + '</b></div>'; 
      let customWindow = this.customWindow; 
      let marker = []; 
      marker = new google.maps.Marker({ 
       map: this.map, 
       position: new google.maps.LatLng(i.latitude, i.longitude) 
      }); 
      marker.setAnimation(google.maps.Animation.BOUNCE); 
      //let marker = this.marker; 
      setTimeout(function() { 
       marker.setAnimation(null); 
      }, 1500); 
      //marker.content = '<div class="infoWindowContent">' + i.restaurantName + '</div>'; 
      google.maps.event.addListener(marker, 'click', (function(marker, i) { 
       return function() { 
        restoInfoWindow.setContent(customWindow); 
        restoInfoWindow.open(this.map, marker); 
       } 
      })(marker, i)); 
      this.markers.push(marker); 
     } 

所有的标记点击但点击进一步NG单击不工作的信息窗口负载 NG单击犯规打在指令所要求的angularjs功能。
我已经同时使用span和div尝试,但问题依旧,仍然没有呼叫。 由于事先NG单击不工作的信息窗口地图标记

回答

0

,而不是仅仅

this.customWindow = '<div ng-click="mapSearchController.....'; 

你需要使用$编译服务。

$compile('<div ng-click="mapSearchController.....')($scope); 

$范围应mapSearchController

的范围,只有在这种情况下你的NG-点击将正常工作。

+0

其实我使用angularjs +流动指令,并不能使用$编译以及在它$范围...... –

+0

可以在创建https://jsfiddle.net例子吗?这将有助于了解你确实有? –

相关问题