Arun Abraham Arun Abraham - 2 months ago 11
AngularJS Question

How to display java String with html tag appended, with the html behavior in angualrjs front end

I have a string in java,I need to append html tag to it dynamically so that when displayed in the frond it,the html tags behavior is felt.
Eg:-
String content="Hello World,this is a test content to demonstrate the requirement";
In the above string content is wrapped inside the tag.But when I am trying to display it in angularjs front end,the string is not taking the tag behavior and displayed as "Hello World,this is a test content to demonstrate the requirement".

Thanks

pD7 pD7
Answer

use angular-sanitize.js for the same - example

<div ng-controller="testCtrl">
   <div ng-bind-html="stringTest"></div>
</div>