shadow00
shadow00

Reputation: 245

ng-include is displayed as a comment

I am trying add a template inside a google maps infowindow but when i try to compile the content and set it to infowindow.content, it is displayed as a comment. I am using the version 1.2.27.

var infowindow = new google.maps.InfoWindow();
var content = '<div id="iw_c" ng-include="\'/infowindow.html\'"></div>';
var compiled = $compile(content)(scope);
infowindow.setContent(compiled[0]);
console.log(infowindow.content);

And this is the output from console.log(infowindow.content)

<!-- ngInclude: '/infowindow.html' -->

Already tried the solution in this question.

Upvotes: 1

Views: 889

Answers (1)

shadow00
shadow00

Reputation: 245

Don't know why but putting a div before ng-include div solved the problem.

var infowindow = new google.maps.InfoWindow();
var content = '<div><div id="iw_c" ng-include="\'/infowindow.html\'"></div></div>';
var compiled = $compile(content)(scope);
infowindow.setContent(compiled[0]);
console.log(infowindow.content);

Upvotes: 3

Related Questions