Arun Abraham Arun Abraham - 2 years ago 95
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.
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".


pD7 pD7
Answer Source

use angular-sanitize.js for the same - example

<div ng-controller="testCtrl">
   <div ng-bind-html="stringTest"></div>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download