Sorry for bad question format before. Changing this now
I have a html string which uses the ngrepeat to render the required div..
var templateHTML = "<div ng-repeat='entity in createCtrl.finalCCList'>\
<span>{{entity.name}}</span>\
</div>";
Here "createCtrl.finalCCList" has list of entity object which has name and id properties in it. Now when I try to compile this using -
var compiledTemplateHTML = $compile(templateHTML)($scope);
if (compiledTemplateHTML && compiledTemplateHTML[0]) {
return compiledTemplateHTML[0].outerHTML;
}
else {
return "";
}
I get nothing. Whereas i checked and $scope.createCtrl.finalCCList does have the required values.
Am I missing anything here.
$compile
? there are very few reasons to do this, and almost always a better way to structure your code. Secondly, I don't think that$compile
returns an array....