Reputation: 3626
I am trying to create a directive this way -
scope.nodeTemplate = '{{node.nodeText}}';
Part of template
'<ul>' +
'<li class="tree-node" data-ng-repeat="node in nodes">' +
'<span>' + scope.nodeTemplate + '</span>' +
'</li>' +
'</ul>'
Based on some condition I would like to change the nodeTemplate
and it can be an html string like -
'<input type="text"/>'
But the issue is when it try to do this thing angular
does not render the html. It simply puts the html string. I am kind of stuck here. Can someone suggest some solution?
Upvotes: 1
Views: 109
Reputation: 718
You need to use ng-bind-html-unsafe like:
'<span ng-bind-html-unsafe="nodeTemplate"></span>'
Upvotes: 2