Reputation: 1565
I'm trying to add a ng-click handler to some dynamic html in my infoWindow as below, which works fine for regular angular directives, but not here with the infoWindow:
google.maps.event.addListener(marker, 'click', function() {
console.log('will compile',marker.cinemaInfo);
var html = $compile(marker.cinemaInfo)(scope);
infowindow.setContent(html);
}
infowindow.open(scope.map,marker);
scope.$apply();
});
Upvotes: 2
Views: 955
Reputation: 639
Hmm, although there are some posts saying people need outerHTML, in my case, I have the following version working:
var html = $compile(marker.cinemaInfo)(scope);
infowindow.setContent(html[0]);
INSTEAD OF:
var html = $compile(marker.cinemaInfo)(scope);
infowindow.setContent(html[0].outerHTML);
Upvotes: 4