Essentially what I am doing is requesting a template from my server. A short example of this looks something like this:
$scope.template = {
'title': 'default',
'description': 'default template',
'html': '<html><head><style>body {background: red;}</style></head><body>{{data.name}}</body></html>'
}
$scope.data = {
name: 'John'
}
This is the JSON object I am receiving from my server. I want to render this into the DOM. What would show up, is just what is store in $scope.name
.
I have this in my angular
app.filter("trust", ['$sce', function($sce) {
return function(htmlCode){
return $sce.trustAsHtml(htmlCode);
};
}]);
And this in my HTML
<div ng-bind-html="template.html | trust"></div>
This renders the html, but leaves {{name}} as {{name}}, when it should say John.