Issue
I'm using AngularJs and I need to render into a JSP page the HTML elements that are into a string variable in the Controller as below:
$scope.myVar = "<h1>Title</h1><p>More information <a href="linkhere">Click here</a></p>";
So in JSP page I have something like:
<div class="panel-body">
{{myVar}}
</div>
But the UI only prints the plain text of the variable. How can I solve this situation?
Solution
Use AngularJs ng-bind-html directive to render HTML.
( Docs )
<div class="panel-body" ng-bind-html="myvar"></div>
Answered By - Tushar
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.